[racket-dev] for/vector much slower than vector-set! ?

From: Sam Tobin-Hochstadt (samth at ccs.neu.edu)
Date: Mon Jul 18 18:09:41 EDT 2011

On Mon, Jul 18, 2011 at 6:01 PM, John Clements
<clements at brinckerhoff.org> wrote:
> Does the first one somehow have to check some things that the second one doesn't?

Yes, how long the vector is going to be.

Try:

 (for/vector #:length (* 100 sr) ([i (in-range (* 100 sr))]) 0.243)

which is just as a fast as the `vector-set!' code on my machine.
-- 
sam th
samth at ccs.neu.edu


Posted on the dev mailing list.