[racket] Why is this slow?
Gary Baumgartner <gfb at cs.toronto.edu> writes:
> The `range` function produces a list, which is a big overhead for each time
> the inner loop executes. There's a big improvement changing the inner loop
> sequence clause to just [p n]. There's a bit more improvement making that
> [p (in-range n)], which is recognized statically at expansion time by the
> `for` loop to produce better code. See:
>
> http://docs.racket-lang.org/guide/for.html#(part._for-performance)
Thank you! That worked wonders :)
- Jordan