From 622aee0c752fe4c116d3153c6cc75ab5631f410f Mon Sep 17 00:00:00 2001 From: Nathan Braswell Date: Tue, 12 May 2020 16:36:07 -0400 Subject: [PATCH] Add fib example to web page --- index.html | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index ad696bd..486a8f6 100644 --- a/index.html +++ b/index.html @@ -28,6 +28,8 @@ #method_output { height: 7em; width: 70em; } #bf_editor { height: 62em; width: 70em; } #bf_output { height: 7em; width: 70em; } + #fib_editor { height: 8em; width: 70em; } + #fib_output { height: 7em; width: 70em; } @@ -42,6 +44,7 @@
  • Example: Implementing Methods
  • Example: Embedding BF
  • Performance Benchmarks +
  • Example: Fibonacci
  • Next Steps @@ -179,7 +182,7 @@ Note that the current implementation is inefficent, and sometimes has problems r

    Performance Benchmarks

    -

    Performance is quite poor, as almost no work has gone into it as of yet. +

    Performance is quite poor (for the interpreter mainly, the C compiler seems to be smart enough to make even the very inefficent generated C code fast), as almost no work has gone into it as of yet. We are currently focusing on the FUN-GLL macros and creating a more fully-featured language on top of the core Lisp using them. We will focus more on performance with the implemenation of the functional persistant datastructures and the self-hosting rewrite, and performance will be the main focus of the RVSDG IR part of the project.

    Even so, it is worth keeping a rough estimate of performance in mind. For this, we have compiled a very basic benchmark below, with more benchmark programs (sorting, etc) to be included as the language gets developed:
    @@ -201,6 +204,20 @@ Note that the current implementation is inefficent, and sometimes has problems r +
    + Here is the core Lisp code run / compiled by the two above tests, which you can run in your web browser. The hand-written C code is an exact translation of this into ideomatic C. +
    Note: N is lowered in the web demo so WebAssembly doesn't run out of memory. +
    +

    Fibonacci:

    +
    +
    (def! fib (fn* (n) (cond (= 0 n) 0 + (= 1 n) 1 + true (+ (fib (- n 1)) (fib (- n 2)))))) +(let* (n 16) + (println "Fib(" n "): " (fib n))) +
    +

    Output:

    +

    Next Steps

      @@ -225,7 +242,8 @@ Note that the current implementation is inefficent, and sometimes has problems r var hello_editor = ace.edit("hello_editor") var method_editor = ace.edit("method_editor") var bf_editor = ace.edit("bf_editor") - for (let editor of [hello_editor, method_editor, bf_editor]) { + var fib_editor = ace.edit("fib_editor") + for (let editor of [hello_editor, method_editor, bf_editor, fib_editor]) { editor.session.setMode("ace/mode/clojure") editor.setOption("displayIndentGuides", false) editor.setShowPrintMargin(false)