[plt-scheme] More PLT Scheme as an Alternative to Matlab

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Fri Aug 14 09:48:23 EDT 2009

At Thu, 13 Aug 2009 21:24:34 -0600, Doug Williams wrote:
> * However, if you're doing a lot of work *inside* Scheme, then things
> >  can become very inefficient.  For example, say that you want to loop
> >  over a floating point array and multiply all of the values by a
> >  given factor.  What will happen in this case is: each time you read
> >  a value, you allocate a Scheme object for the fp number, multiplying
> >  that allocates a new one, then saving it copies the result back to
> >  the array, leaving the two allocated values to be GCed.  (There are
> >  some JIT-level optimizations for fp numbers, I don't know if it can
> >  save one of these allocations in this case.)

My guess is that the GC-allocation issue is now not as important as the
lack of inlining for SRFI-4 vector accesses and updates. It may be
worthwhile to shift those operations into the core where the JIT can
easily improve them.

> My plan would be to do the work inside of Scheme - at least for now. It
> would be interesting to see if there are some JIT optimizations planned for
> the future that could help.

As soon as I get enough time, I plan to finally experiment with unsafe
operations, like `vector-ref', `car', and `fl+' that don't check their
arguments.

Longer term, I think we'll need better supprot for SRFI-4 vectors
combined with some way of unboxing floating-point arithmetic.

Those are very rough plans, I know.



Posted on the users mailing list.