[plt-scheme] Experience Using Mz(Dr)Scheme for Numerical Work

From: jekwtw (jeaniek7 at comcast.net)
Date: Sun Apr 17 20:35:15 EDT 2005

Could you expend a few bits describing the cuspy features of PLTScheme
modules that are not supported by Common Lisp packages (no Holy Wars here; I
got burned on CL packages once and don't view the feature as the answer to
all information-hiding and decomposition problems).


 -- Bill Wood
    bill.wood at acm.org

----- Original Message ----- 
From: "Eli Barzilay" <eli at barzilay.org>
To: "Will M. Farr" <farr at mit.edu>
Cc: <plt-scheme at list.cs.brown.edu>
Sent: Sunday, April 17, 2005 4:00 PM
Subject: Re: [plt-scheme] Experience Using Mz(Dr)Scheme for Numerical Work

>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> On Apr 17, Will M. Farr wrote:
> > [...]
> > Unfortunately, after writing the same simple integrators in C,
> > common lisp, and scheme, I find that, even with a C-coded inner
> > loop, DrScheme/MzScheme are about 10 times slower than SBCL, and 15
> > times slower than straight C.  The difficulty seems to be that
> > computing m1*m2/r12^2 isn't enough work to offset the baggage that
> > comes with a FFI call, and the looping overhead.
> > [...]
> Yes, looping would be the computational bottleneck if you use Scheme
> with lots of simple computations.  One thing to consider is to use
> _fixnum if you know you'll never get bignums -- _fixnum uses a cheaper
> translation when going to/from C.
> Another thing that might be viable is to use bindings from something
> like GSL -- using the foreign interface it is really simple to pull a
> few functions out.  I don't know whether this can be a solution or not
> since I don't know what an advanced integrator is -- and the same
> holds for moving the loops on to C.  (If you want to do that, then it
> is also simple to write straight C code and use foreign to interface
> that.)
> If there is no clear way to separate out some computation intensive
> core out to C, then for now CL would be a better choice -- you could
> in that case use one of the packages that allow porting simple code
> from Scheme to CL, even if it results in incomprehensible Lisp code.
> (You could use some Scheme macro for loops and translate that to Lisp
> iterations.  With modules you will be stuck -- CL is much poorer in
> that department.)
> -- 
>           ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
>                   http://www.barzilay.org/                 Maze is Life!

Posted on the users mailing list.