News for hackers. Stuff that matters.
Re:SBCL quicker than C? by rst on Tuesday February 08, 2011 @07:54AM (#2192675)
SBCL = Steel Bank Common Lisp

More precisely, if you tell the SBCL compiler to trust that all data types are as declared and omit type checks, it gives you code that's faster than gcc with the options at the bottom of this page: http://shootout.alioth.debian.org/u32/benchmark.php?test=spe...

These are "inner loop only" compiler settings, at least the way I'd use it --- but it's still nice to see concrete demonstrations that you don't have to drop down to C code to get maximum performance.

EDIT: (declaim (safety 0)) also omits array bounds checks, and checks for undefined variables.

Re:SBCL quicker than C? by igouy on Tuesday February 08, 2011 @11:35AM (#2193470)
>>it gives you code that's faster than gcc with the options at the bottom of this page<<

1) Here are the timings for the C program you linked (x86 Ubuntu one core) -

spectral-norm C GNU gcc #4

N CPU Elapsed

500 0.09 0.10

3,000 3.31 3.32

5,500 11.13 11.14

2) Here are the corresponding timings "if you tell the SBCL compiler..."

spectral-norm Lisp SBCL #2

N CPU Elapsed

500 0.06 0.16

3,000 4.64 4.70

5,500 15.69 15.72

3) Is the program on the page you linked to faster or slower than the SBCL program ?

http://shootout.alioth.debian.org/u32/performance.php?test=s...

Re:SBCL quicker than C? by rst on Tuesday February 08, 2011 @01:57PM (#2194254)
Bolla says that alioth blew it, by not asking SBCL for full optimization --- and he does in fact get different timing with the optimization in place.

From the original post:

    N=500
    gcc 0.15u 0.00s 0.17r
    sbcl 0.08u 0.02s 0.21r

    N=3000
    gcc 5.60u 0.00s 5.69r
    sbcl 5.18u 0.01s 5.41r

    N=5500
    gcc 18.81u 0.01s 19.12r
    sbcl 17.42u 0.02s 17.76r
I mentioned the alioth page mainly so people could see how gcc was being run.
Re:SBCL quicker than C? by igouy on Tuesday February 08, 2011 @04:03PM (#2194844)
>>Bolla says that alioth blew it, by not asking SBCL for full optimization<<

No he doesn't.

The spectral-norm Lisp SBCL #2 program is Lorenzo Bolla's program - look at the program source code

http://shootout.alioth.debian.org/u32/program.php?test=spect...

>>he does in fact get different timing with the optimization in place<<

He get's different timing but the only explanation he provides is "So, different numbers on different boxes, which is not at all unexpected."

Re:SBCL quicker than C? by igouy on Tuesday February 08, 2011 @06:47PM (#2195450)
>>Bolla says that alioth blew it, by not asking SBCL for full optimization<<

Maybe you should ask Lorenzo Bolla if he was trying to create misunderstanding by posting one of his old (December 5th, 2010) blog entries to HN ;-)

The benchmarks game website has been showing Lorenzo Bolla's spectral-norm Lisp SBCL #2 since December 8th 2010.