Optimizing Lisp Some More(nklein.com)
nklein.com
Optimizing Lisp Some More
http://nklein.com/2009/06/optimizing-lisp-some-more/
4 comments
The only difference between the SBCL decls + noopt version and the decls + optimizations version, at least when I compiled it with SBCL 1.0.40.0, is the number of generated nops used to align the beginning of the inner loop which really shouldn't be noticeable at all. I'm guessing the 60ms difference between the two is just noise rather than the appearance of a difference in code generation.
I think the author can make the loops faster by adding (the ...) forms where he adds and multiplies numbers. Also, he should declare the types of his loop control variables. Just a theory, though: I haven't run the code or looked at its disassembly output.
why is clisp so slow? design decisions? has development stagnated?
Last I knew, CLISP was based on a bytecode VM while SBCL and Clozure generate machine code. I think there may be some work on adding a JIT to CLISP but as far as I know it's still experimental.
It also might be good to use a macro or compiler macro to unroll the loops, then you don't have to worry about manipulating 2 looping pointers. All you'd end up with is a bunch of constant arefs and addition/multiplication.
He also might want to set debug to 0, although I don't have any way to test that (or any of this) at the moment.
Then you get something that looks like this:
http://paste.lisp.org/display/120946
I haven't tested it (I don't even know if it works!), but the disassembly looks faster...
/rampant speculation.