Hi Alex,

> It runs without problems.

great!

> I'm a little bit surprised, however, that it is so extremely slow.
> How can these huge differences be explained?

I wasn't aiming for speed with this first version but rather for
understanding of the underlying concepts, namely how evaluation and
shallow binding works and creating simple but generic and powerful Java
FFI.  If you have a look at the code, you'll find that only necessary
minimum is implemented in Java, the rest is in java.wl file.

>    (de fibo (N)
>       (if (> 2 N)
>          1
>          (+ (fibo (dec N)) (fibo (- N 2))) ) )
>    (fibo 36)
>    (bye)

For example, even simple 'if' is implemented as a picolisp fexpr:

   (de if (C . L)
      (loop
         (T C (up. '@ @) (eval (car L) 1))
         (T T (run (cdr L) 1)) ) )

Basically, none of the stuff in the Fibonacci test is direct native
code, but all is in turn interpreted using only a few core native
functions.  I think a major speed-up would be achieved by writing these
functions directly in Java, as you are doing with ErsatzLisp.

>               java wl    ErsatzLisp   Pil32    Pil64
>              +---------------------------------------
>    (fibo 22) |   25        0.19       0.015    0.016
>    (fibo 23) |   45        0.25       0.026    0.024
>    (fibo 24) |   69        0.36       0.041    0.039
>    (fibo 25) |  122        0.52       0.060    0.063

Interesting.  Just curious: how did you measure those times?

>>    $ java wl
>>    : (load "swing5.l")
>
> This produces a Celsius/Farenheit dialog. The input field does not
> respond, however, and if I press the button it crashes with a
> RuntimeException. Can the reason be that I'm usin OpenJDK?

Works fine for me.  I'm using:

   $ java -version
   java version "1.6.0_18"
   OpenJDK Runtime Environment (IcedTea6 1.8.1) (6b18-1.8.1-0ubuntu1)
   OpenJDK 64-Bit Server VM (build 16.0-b13, mixed mode)

What is the stack trace you get?

Thank you,

Tomas
-- 
UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe

Reply via email to