Open mvoidex opened 7 years ago
Interesting. It would take some investigation. Maybe you could post a full program? I don't think sampling 1e6 normals should take even a second but maybe my intuition is incorrect.
Here
module Main where
import Control.Monad
import Control.DeepSeq
import Data.Random
import System.Random
main :: IO ()
main = do
-- dbls <- (fst . sampleState (replicateM 1000000 stdNormal :: RVar [Double])) <$> newStdGen
dbls <- runRVar (replicateM 1000000 stdNormal :: RVar [Double]) StdRandom
dbls `deepseq` print (length dbls)
Results: ~1.5 secs vs ~20
Why
sampleState (replicateM 1000000 stdNormal :: RVar [Double]) g
much faster (<1 src vs ~20 secs) than
runRVar (replicateM 1000000 stdNormal :: RVar [Double]) StdRandom
?