Posts Tagged ‘lisp sbcl c shootout’

SBCL quicker than C?

December 5, 2010

after reading a nice conversation on comp.lang.lisp I decided to play a little bit with SBCL and Debian’s Shootout Benchmarks.

I considered the spectral norm benchmark and compared the C and SBCL implementations.

I started re-running the tests without any further optimization and the results were similar to the ones reported with C beating SBCL by a factor of 2.
(for the C optimization used, see here).

then, I noticed that there was no (declaim (optimize (speed 3) (safety 0) (space 0))) in the SBCL file!

I’ve added it and rerun the test. here are my results:

gcc 0.15u 0.00s 0.17r
sbcl 0.08u 0.02s 0.21r

gcc 5.60u 0.00s 5.69r
sbcl 5.18u 0.01s 5.41r

gcc 18.81u 0.01s 19.12r
sbcl 17.42u 0.02s 17.76r

the SBCL implementation is actually faster than C!

you can find the code for the tests here.