
25 Mar
2009
25 Mar
'09
4:13 a.m.
To make a long story short, here is the library code: elems arr = case bounds arr of (_l, _u) -> [unsafeAt arr i | i <- [0 .. numElements arr - 1]
And my version: boundedElems arr = case bounds arr of (_l, _u) -> [unsafeAt arr i | i <- [1737 .. 1752]]
Is there a reason, why the library version is 4 times faster, than mine?
There shouldn't be any reason. Try putting
{-# INLINE boundedElems #-}
to make it inline, it might be faster.
Ah, ok, did that, but no difference. :) If I got it right, for the library version exists a C-translation while for my version there isn't.