From: David Steuber
Subject: Urban performance legends, revisited
Date: 
Message-ID: <87hdbq4neb.fsf@david-steuber.com>
This article on IBM's website was posted to slashdot today:

http://www-128.ibm.com/developerworks/java/library/j-jtp09275.html?ca=dgr-lnxw01JavaUrbanLegends

How do the various Lisp implementations stack up to Java in terms of
memory management performance?  A quote from the article:

    * The common code path for new Object() in HotSpot 1.4.2 and later
    * is approximately 10 machine instructions (data provided by Sun;
    * see Resources), whereas the best performing malloc
    * implementations in C require on average between 60 and 100
    * instructions per call (Detlefs, et. al.; see Resources). And
    * allocation performance is not a trivial component of overall
    * performance -- benchmarks show that many real-world C and C++
    * programs, such as Perl and Ghostscript, spend 20 to 30 percent
    * of their total execution time in malloc and free -- far more
    * than the allocation and garbage collection overhead of a healthy
    * Java application (Zorn; see Resources).

When I have run TIME on various Lisp functions I have written, I have
spent as much as 30% of the reported time in GC.  I have also been
able to make use of DECLARE to get GC down to nothing.

I don't know what constitutes a "healthy Java application" (or any
other kind of application for that matter), however back in August I
had completed an entry for a fractal speed competition[1] that Apress
was running as a promotion.  I wrote my entry in 100% Lisp and used
SBCL's sb-sprof to help me speed it up.  When I finished with it, I
had no more hotspots left but it was still between 3-5 times slower
than a C implementation written by Yannick Gingras.  I don't really
know where the time is going as it seems so evenly divided.  In gross
terms, most of the time was spent in the JPEG encoding.

A heavily numeric application is likely to be at a disadvantage if one
lnague forces it to do GC and another doesn't.  However, I couldn't
help but noticed that both C# and Java seem faster than my code.

[1] http://www.david-steuber.com/Lisp/Apress-Fractal-Contest/

As a sidebar, anyone interested in making the Lisp code faster feel
free to give it a go.

-- 
http://www.david-steuber.com/
The UnBlog | Lisp on OS X topics for the most part
Click all the links you want.  I'll make more!