[Haskell-cafe] Squashing space leaks

Greg Buchholz haskell at sleepingsquirrel.org
Fri May 6 10:58:26 EDT 2005

Daniel Fischer wrote:
> The problem is that a prime crept in in Josef's code,
> so to calculate the positions and velocities, the updated versions of the 
> planets are used, it should be

    Ah, yes, thanks for the correction.
> Besides, offset_momentum does not use the parameter n at all and I think that 
> all the indexing in the computation of the potential energy is rather 
> inefficient.

    I wasn't too worried about the energy function, since it only gets
called twice, whereas the "advance" get called potentially millions of
times (and must be the source of the space leak).  You can see one
profile I ran (for n=1000 instead of 1000000) at...



Greg Buchholz 

More information about the Haskell-Cafe mailing list