21 Sep
2017
21 Sep
'17
12:05 a.m.
Hi Stanislav, Станислав Черничкин <schernichkin@gmail.com> writes:
I've wrote simple Haskell benchmark program, which populated primitive vector from vector package:
... void $ for [0..1000000 - 1] $ flip (P.unsafeWrite v) (1 :: Int)
'for' is a variant of 'map' - it returns a list of results (in this case a list of a million () values). Instead you should use 'forM_' (note the underscore) from Control.Monad, which discards the result - that cuts the runtime by a huge amount when I try it. (And make sure to compile with -O too.) Nick