He's using vectors with clojure and lists with lisp. Why? It looks like he's concatenating vectors, which is O(n), with clojure, but cons'ing lists, which is O(1), with lisp. As much as I like seeing clojure's performance get critiqued, this comparison doesn't seem fair at all. Why aren't the implementations identical?
SBCL is very impressive. Until recently[1], it was far and away the quickest implementation for a dynamic language. Considering we have yet to see invokedynamic or tail calls on the JVM, I'm rather unsurprised by SBCL's comfortable lead in performance.<p>[1] LuaJIT 2
It seems easy to hit some implementation wart that makes performance abysmal - it's hard to believe that a JVM targeted language would be 20x times slower. Case in point - I tried the benchmark with a bigger input - the performance ratio between the 'fast' implementations remained the same. Incredibly, though, the CL implementation took nearly 2 minutes to construct the input string, something that is essentially instant in the Clojure version.<p><pre><code> time sbcl --noinform --load palindromes.lisp --eval "(progn (big-test) (quit))"
30000 X ' amanaplanacanalpanama '
fast :
Evaluation took:
0.197 seconds of real time
0.191206 seconds of total run time (0.186952 user, 0.004254 system)
[ Run times consist of 0.006 seconds GC time, and 0.186 seconds non-GC time. ]
96.95% CPU
471,342,768 processor cycles
13,802,832 bytes consed
real 1m55.551s
user 1m51.954s
sys 0m0.778s</code></pre>
I don't know much about optimization, but...it looks like he's timing the Clojure version with Clojure already loaded, but timing the SBCL version with SBCL not loaded. Would that change the measurements much?