
11 Jun
2012
11 Jun
'12
6:17 a.m.
On 11 Jun 2012, at 10:38, Dmitry Dzhus wrote:
main = do g <- create e' <- VU.replicateM count $ standard g return ()
In all likelhood, ghc is spotting that the value e' is not used, and that there are no side-effects, so it does not do anything at runtime. If you expand the action argument to replicateM, such that it uses do-notation instead, perhaps ghc can no longer prove the lack of side-effects, and so actually runs the computation before throwing away its result. When writing toy benchmarks in a lazy language, it is always important to understand to what extent your program _uses_ the data from a generator, or you are bound to get misleading performance measurements. Regards, Malcolm