[racket] Why is this slow?

From: Jordan Schatz (jordan at noionlabs.com)
Date: Thu Apr 25 01:45:40 EDT 2013

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

Posted on the users mailing list.