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.
I just started reading the thread linked from the blog post, and it felt like reading House of Leaves. Here are some choice quotes from various authors:
Re Clojure: "This is a 'babel' plot to destroy lisp."
"Pocket Forth is a free Forth interactive-interpretor that runs fine on my Macintosh "Performa 600" (68030-CPU) System 7.5.5."
"The Mac is a desktop-publishing 'appliance' --- considering
that you don't have a laser-printer, a Mac is about as useful to you as a bicycle is to a fish. Besides that, you don't seem like the desktop-publishing type of guy --- that is mostly a marketing-department girl thing."
"I really foresee the collapse of civilization. The majority of people in America are motivated entirely by hate, fear, greed and envy, and this situation can't continue indefinitely. This is what I describe in my book, 'After the Obamacalypse,' which is included in the slide-rule package on my web-page."
Another time I was sitting in my van in a parking lot. A skinny
Jew walked up to the van, peered inside, then tried to open the door
but discovered that it was locked, so he walked away. I got out and
walked over to him, and I said: "What the hell do you think you're
doing?" He also said that he thought it was his friend's van, but he
didn't apologize at all, but became prideful and belligerent. When I
said, "I think you're a thief," he said: "Look at the way you're
dressed; you're the thief!" (I was wearing a hoodie). He told me that
if I continued bothering him, he was going to call the police, and he
got out his cell-phone. When I said, "I think you were looking for
something to steal," he said: "There is nothing in your van worth
stealing!" I beat him thoroughly with my fists and left him face down
on the sidewalk in his own blood. Somewhat belatedly, be began to cry:
"I'm sorry! I'm sorry!"
It ends shortly after "Discussion subject changed to 'Whining (was Re: ordered associative arrays)' by John Passaniti."
One of the reasons I left comp.lang.lisp (I used to be part of that community) was because there were so many people there who would, at the slightest provocation, fly off the handle and explain to you their alternative theory of whatever. A lot of crazy people.
It seemed like for every Peter Seibel or Kenny Tilton, there were 8 people who had 10% of 100 projects done, were happy to tell you about the anti-lisp conspiracy, and also had alternative health advice.
He specifically asked gcc for optimisation for code size (-Os). For speed, he should be using -O3 only. He used "-Os -O3". This invalidates the benchmark.
Is this really still news? Yes, we know you can get great performance in some tasks with languages other than C. I swear, if I see ANOTHER article with the linkbait title of "X faster than C"...
The decent ones posted at least bother to do a comparison with several pseudo-representative tasks. This one just goes "hey, I played around with this ONE SPECIFIC TASK NOBODY GIVES A CRAP ABOUT and IT RAN 0.006 MILLISECONDS FASTER THAN IN C! WOOOOOOOOOOOO!"
"We beat C" is a claim that goes hand in hand with "we are viable for scientific computing", so I'm always interested in hearing it (although more benchmarks would be nice).
At least in the past the Shootout code wouldn't have explicit (declaim (optimize ...)) in the source files, but the command used to compile the files would have it. Did it really get removed from the command line?
Alexey Voznyuk wanted it removed - My point is that obligatory "(optimize (speed 3) (safety 0) (debug 0) (compilation-speed 0) (space 0))" is totally wrong.
After reading all these interesting and enlightening comments (no pun intended here, there are all really useful), the blog post should really be titled:
"A particular SBCL-compiled LISP-implementation of a specific algorithm gives comparable results to an analogous GCC-compiled C-implementation, when run on particular boxes."
[+] [-] rst|15 years ago|reply
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.
[+] [-] igouy|15 years ago|reply
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...
[+] [-] stevejohnson|15 years ago|reply
Re Clojure: "This is a 'babel' plot to destroy lisp."
"Pocket Forth is a free Forth interactive-interpretor that runs fine on my Macintosh "Performa 600" (68030-CPU) System 7.5.5."
"The Mac is a desktop-publishing 'appliance' --- considering that you don't have a laser-printer, a Mac is about as useful to you as a bicycle is to a fish. Besides that, you don't seem like the desktop-publishing type of guy --- that is mostly a marketing-department girl thing."
"I really foresee the collapse of civilization. The majority of people in America are motivated entirely by hate, fear, greed and envy, and this situation can't continue indefinitely. This is what I describe in my book, 'After the Obamacalypse,' which is included in the slide-rule package on my web-page."
It ends shortly after "Discussion subject changed to 'Whining (was Re: ordered associative arrays)' by John Passaniti."[+] [-] KirinDave|15 years ago|reply
It seemed like for every Peter Seibel or Kenny Tilton, there were 8 people who had 10% of 100 projects done, were happy to tell you about the anti-lisp conspiracy, and also had alternative health advice.
[+] [-] e40|15 years ago|reply
Second, someone upvoted this??
[+] [-] unknown|15 years ago|reply
[deleted]
[+] [-] unknown|15 years ago|reply
[deleted]
[+] [-] zachbeane|15 years ago|reply
[+] [-] rlpb|15 years ago|reply
[+] [-] JoachimSchipper|15 years ago|reply
[+] [-] regularfry|15 years ago|reply
[+] [-] MtL|15 years ago|reply
$ gcc -c -Q -Os -O3 --help=optimizers > Os-O3-opts
$ gcc -c -Q -O3 --help=optimizers > O3-opts
$ diff Os-O3-opts O3-opts
$
[+] [-] McP|15 years ago|reply
[+] [-] slavak|15 years ago|reply
The decent ones posted at least bother to do a comparison with several pseudo-representative tasks. This one just goes "hey, I played around with this ONE SPECIFIC TASK NOBODY GIVES A CRAP ABOUT and IT RAN 0.006 MILLISECONDS FASTER THAN IN C! WOOOOOOOOOOOO!"
[+] [-] neutronicus|15 years ago|reply
[+] [-] brownegg|15 years ago|reply
I mean, if I could really get C performance out of SBCL (and for my purposes, I can't), I'd sure as hell want to know.
Think cold fusion. Sure, "wolf" has been cried a lot of times, but you're still going to want to know as soon as it happens "for real".
[+] [-] jsnell|15 years ago|reply
[+] [-] igouy|15 years ago|reply
[+] [-] unklem|15 years ago|reply
[+] [-] lbolla|15 years ago|reply