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

Re: Amulet 3 times faster than Garnet



In article <3qvuft$fdj@engr.orst.edu> atwoodj@ada.CS.ORST.EDU (John Atwood) writes:

   the number 3 comes from the Garnet/Amulet development team.
   In the Garnet FAQ 
   (http://www.cs.cmu.edu/afs/cs.cmu.edu/project/garnet/garnet/FAQ),
   they answer the question, Why switch to C++, they list political & 
   technical reasons. One technical reason:

   * Speed: We spend 5 years and lots of effort optimizing our Lisp code,
   but it was still pretty slow on "conventional" machines.  The initial

I suspect they spent 5 years developing and some of that optimizing.  Their
change log only mentions optimization 20 times.  

The mention of "conventional" machines suggests that Garnet may have
started on Lisp machines.  When porting to a conventional machine you need
to use declarations wisely, and make other changes to your code.  A quick
grep through the Garnet sources suggets that there is plenty of room for
improvement.  For example:

1.  Of the 1201 declarations there is only 1 fixnum declaration even though
i suspect a graphics application does a lot of fixnum arithmetic (there are
at last 2500 uses of "(+ ", for example.

2. Things like (floor (/ (- fixed-width comp-width) 2)) are a performance
jokes.

3. There are integer declarations, but they are likely to be useless.

Profiling is required to show what optimizations are important, but this
suggests there is plenty of room for improvement.

   version of the C++ version, with similar functionality, appears to be
   about THREE TIMES FASTER than the current Lisp version without any
   tuning at all.

It would be interesting to see how they got similar functionality in C++.
For example, it looks like the kr language (ie, kr-send, g-value) makes
heavy use of binding special variables, which is not a fast operation.
They probably did that some other way in C++.  Perhaps the Lisp version
should take advantage of this too.

   The C++ code is now available (Amulet alpha 0.2) at:
   http://www.cs.cmu.edu/afs/cs/project/amulet/www/amulet-home.html

Thanks, i'll take a look.
--
Ken Anderson 
Internet: kanderson@bbn.com
BBN ST               Work Phone: 617-873-3160
10 Moulton St.       Home Phone: 617-643-0157
Mail Stop 6/4a              FAX: 617-873-2794
Cambridge MA 02138
USA