[racket] translate from Racket to Common Lisp
At Fri, 2 Nov 2012 16:25:09 +0000 (UTC), daniel rupistraliz avez wrote:
> One motivation is speed, for example a recent example in the racket blog about
> the 2n+1 problem gives 1200 milliseconds in Racket and 500 in sbcl (without
> declaring fixnum or any other optimization).
Although it's not really your question, I'm generally interested in
understanding performance differences. Can you tell me more about what
you're measuring, and maybe provide the SBCL version of the code that
you're using?
If I take Danny's code form the blog and just try
time racket three-n-plus-one.rkt < sample-data.txt
on the command line, it takes 720 millisecond on my machine, but
essentially all of that time is loading and compiling the code.
Wrapping `time' around the body of the `main' submodule shows that the
actual computation takes only 2 milliseconds.
If I try
raco make three-n-plus-one.rkt
time racket three-n-plus-one.rkt < sample-data.txt
then the overall time drops down to 264 milliseconds. Some other
changes can reduce the start-up time further, but I don't know if this
is at all related the way you're measuring performance.
So, I wonder whether you're using different inputs and how you're
measuring the run time.
Thanks!