Re: How to make Lisp go faster than C
- From: "Dimiter \"malkia\" Stanev" <malkia@xxxxxxx>
- Date: Mon, 23 Feb 2009 10:44:35 -0800
Ditto, what Waldek is saying about SBCL (and other Lisp Compilers).
For example one thing that bothers me, is that depending on the memory address where the function was compiled it can run slower of faster. Simple explnatation: any loop (jmp, jne, etc. function) that does not go to a 16-th aligned boundary is going to get slower. So depending on where the function compiled (1/4 times) it would get significantly faster. (Wonder how they get proper boinkor results everytime).
But then again it's one of the best compilers I've seen for such a dynamic language.
Waldek Hebisch wrote:
Didier Verna <didier@xxxxxxxxxxxxx> wrote:.Francogrex <franco@xxxxxxxx> wrote:
Read the Research and Development article by Didier Verna:FWIW, try s/imecs/ecoop/. It's the director's cut version. Also, note
http://www.lrde.epita.fr/~didier/research/verna.06.imecs.pdf
that I'm going to present the sequel at ILC.
I appreciate information about optimizing Lisp code contained
in this article. However I consider the claim "Beating C in Scientific
Computing Applications" to be misleading. My personal experience
using both SBCL and C (gcc) is that SBCL generates significantly worse
code than gcc:
1) SBCL in many cases generates shifts/masks due to tags in Lisp
integers. Declaring integers as (unsigned byte 64) (or 32 on
32-bit machines) helps in some cases, but other remain.
2) SBCL frequently generetes "useless" instructions: extra copies,
recomputes sub-expressions which did not change, can not exploit
addressiong modes etc. In other words, SBCL code generator is much
less sophisticated than gcc one.
I would say that in compute-bound code it is hard to get within
factor of 2 using SBCL compared to gcc. Real code is frequenty
memory-bound and this tends to significantly decrease performance
gap. However, in many important cases it is possible to
design algorithms so that data is available in L1 cache -- such
algorithms get full benefit from better code generation. And
on code which is doing many memory accesses gcc will still
have advantage of smaller number of non-memory operations.
Extra remark about the paper:
- C code for add in Listing 1 is pretty inefficient. One thing
is mixing of integer and floating point operations. Another,
probably more important, is use of double indirection, which
forces 4 memory accesses in inner loop.
So kudos for serious work on improving Lisp performace. And
kudos to CMU CL and SBCL developers for good compilers. But
guys, get real, there is long way before for Lisp technology can
match C.
- References:
- How to make Lisp go faster than C
- From: Francogrex
- Re: How to make Lisp go faster than C
- From: Didier Verna
- Re: How to make Lisp go faster than C
- From: Waldek Hebisch
- How to make Lisp go faster than C
- Prev by Date: Re: Calling lisp functions
- Next by Date: Re: please review my new *working* code - now with 20% more oop!
- Previous by thread: Re: How to make Lisp go faster than C
- Next by thread: Re: reading file to list
- Index(es):
Relevant Pages
|