[Prev][Next][Index][Thread]

Re: Fun-O Basic Edition Compiler



Hi Carl,

I expect this isn't the best LispWorks can do either. Try introducing fixnum
type declarations and cranking the optimization levels up and the safety and
debug levels down. By default LispWorks comes with its compiler set to a
happy medium of speed and debuggability. If you want to do benchmarking you
need to adjust it.

__Jason

----- Original Message -----
From: Carl Gay <carlgay@mediaone.net>
To: <info-dylan@ai.mit.edu>
Sent: Wednesday, December 26, 2001 3:00 AM
Subject: Re: Fun-O Basic Edition Compiler


> Scott McKay wrote:
> >
> > Could you post the exact code you used for Dylan, Lisp, and Java?
> > You might not be comparing apples to apples...
>
> Code for all three is below. The Lisp code I typed into the
> listener and then did (compile 'tak) and (compile 'test-tak) and
> ran it with (time (test-tak 2000)).
>
> The Dylan code uses the "timing" macro and is run along with other
> Gabriel benchmarks.
>
> The Java code just uses currentTimeMillis() as you can see.
> Without HotSpot it takes about three times as long as the Dylan
> code, but nobody runs without HotSpot these days.
>
> I'm getting slightly better timings for all three today (not sure
> why) but the relative times are about the same.  I'm on a P3/650
> with win2k.
>
> FunDev        Lispworks     Java       Java
> Prod Mode                              static[1]
> ---------------------------------------------
> 11.314s       6.8s          4.297s     3.795s
> 1.0           1.7x          2.6x       3.0x
>
>
> define method tak (x :: <integer>, y :: <integer>, z :: <integer>)
>   if (y >= x)
>     z
>   else
>     tak(tak(x - 1, y, z),
>         tak(y - 1, z, x),
>         tak(z - 1, x, y))
>   end if
> end;
>
> define function testtak ()
>   for (i from 1 to 2000)
>     tak(18, 12, 6);
>   end;
> end;
>
> (defun tak (x y z)
>   (if (>= y x)
>       z
>     (tak (tak (- x 1) y z)
>          (tak (- y 1) z x)
>          (tak (- z 1) x y))))
>
> (defun test-tak (n)
>   (dotimes (i n)
>     (tak 18 12 6)))
>
> public class Tak {
>     // [1] make this method static
>     public int tak (int x, int y, int z) {
>         if (y >= x)
>             return z;
>         else
>             return tak(tak(x - 1, y, z),
>                        tak(y - 1, z, x),
>                        tak(z - 1, x, y));
>     }
>
>     public static void main (String[] args) {
>         Tak t = new Tak();
>         long start = System.currentTimeMillis();
>         for (int i = 0; i < 2000; i++) {
>             // [1] call static method
>             t.tak(18, 12, 6);
>         }
>         long end = System.currentTimeMillis();
>         System.out.println(end - start);
>     }
> }
>
>



References: