Here a corrected code example with (collect-garbage) to make time measurement
more deterministic and the results (still mutable-array-data is 50% slower than
element-wise access):
#lang racket
(require math/array)
(define arr (mutable-array #[#[1. 2. 3.] #[4. 5. 6.]]))
(define (array->vector1
Converting a mutable-array into a vector in Racket (not Typed Racket) seems to
be faster when done element-wise instead of using mutable-array-data. Why is
this? I always thought crossing the untyped/typed boundary as little as
possible makes things run faster.
This little test program
#lang
2 matches
Mail list logo