Russell Senior wrote:
> 
> Please pardon my optimizing ignorance.  I have recently been rewriting
> a Fortran program in Common Lisp.  For all its ghastly spaghetti-ness
> and incomprehensibility, the Fortran program is quite fast (using g77
> -O6), about 4 seconds for the test case on a 500MHz P3.  My CL
> version, compiled, takes about 36 seconds for the same test case (and
> that is after an algorithmic optimization that saves about a factor of
> 2).
> 

[snip]

> Can anyone give some hints about how to make this faster?  
> 
>   <http://www.aracnet.com/~seniorr/test.lisp>

Taking the idea that it is better to teach a man to fish than to give 
him fish, here are a few suggestions.

o Try compiling with (speed 3).  You'll get lots of useful notes about
   where things aren't has fast as you might want.
o Try profiling the code.
o Read the CMUCL User's Manual on optimization.

 From a quick look at the code, I think there are a few things you can 
do to make it go faster.

o (vector double-float 3) is not as good as
   (simple-array double-float (3)).
o Structures might be faster than classes, especially since you are
   using using 18e.  (CLOS in the soon-to-be-released 19a should be
   faster in many common cases.)

I hope these suggestions will get you started.  If it's still not fast 
enough, please ask again.

Ray


Reply via email to