Newsgroups: comp.lang.lisp
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!MathWorks.Com!europa.eng.gtefsd.com!howland.reston.ans.net!pipex!uunet!franz.com!franz!jkf
From: jkf@Franz.com (Sean Foderaro)
Subject: Re: Squeezing more speed out of LISP.
In-Reply-To: hjstein@sunset.huji.ac.il's message of 16 Oct 94 17:29:05
Message-ID: <JKF.94Oct17062727@frisky.Franz.com>
Sender: news@franz.com
Nntp-Posting-Host: frisky
Organization: Franz Inc., Berkeley, CA
References: <HJSTEIN.94Oct16172905@sunset.huji.ac.il>
Date: Mon, 17 Oct 1994 13:27:27 GMT
Lines: 30

 Ken Anderson recently wrote of his experiences in benchmarking numerical 
code.   You may still have the article available on your site (the 
title is "Fannkuch revisited or Benchmarking is hard").  I can send 
it to you if you don't have it.
  Richard Fateman (fateman@cs.berkeley.edu) wrote the paper claiming Fortran 
speed for Maclisp back in the 70's.   Fortran was simpler back then 
(recursion was illegal).  Lisp was also simpler.  I'm not sure how Fortran has 
evolved but Lisp is certainly more complex today.  Compiler writers love 
simple languages, it makes their job a lot easier.  So Fortran will probably 
always compile numeric code faster than Lisp.  However if you confine your 
Lisp code to the subset of Lisp where the Lisp compiler writer has concentrated
his numerical optimizations then you'll find that Lisp can give you very
good performance.  Specifically
1. store only one type of lisp object in a variable and declare that 
   variable's type.
2. use only simple arrays and declare their types (including their dimensions).
3. avoid operations which would force the compiler to heap allocate
   intermediate results.

[don't forget: see Ken Anderson's article for other suggestions]


 If this doesn't give you enough speed and speed is critical because 
this numeric code will take hours and hours to run, then do as Henry Baker 
suggests.  Write it in Fortran and have your Lisp program call it.


-john foderaro
 franz inc.

