If you run Optimization Coach on this like Greg suggested, it immediately tells you that the loop body is slow because the /
function is doing mixed arithmetic (on a fixnum and a flonum). If you insert a (fx->fl i)
in place of i
it's faster (close to 2x on my machine).
Also, if you are timing this in DrRacket you will want to time it with the racket
executable instead. DrRacket adds debugging instrumentation that helps during development, but isn't good for timing.