plt/racket — pull request #181 by ianj (2012-11-29 15:41:34+00:00)
Title: Peephole optimizations for small iterations in for

Added additional case for empty set, since constructing the set shim takes a considerable amount of time. The following expressions show the difference for syntactically apparent empty set construction.
> (define s set)
> (time (for* ([n (in-range 1 1000000)] #:when (number? (random n)) [i (in-set (s))]) (printf "Fail")))
cpu time: 200 real time: 201 gc time: 4
> (time (for* ([n (in-range 1 1000000)] #:when (number? (random n)) [i (in-set (set))]) (printf "Fail")))
cpu time: 120 real time: 122 gc time: 0