Skip to content

Instantly share code, notes, and snippets.

@nobsun
Created June 21, 2014 08:33
Show Gist options
  • Save nobsun/a0c0c491dbb7bad2d22a to your computer and use it in GitHub Desktop.
Save nobsun/a0c0c491dbb7bad2d22a to your computer and use it in GitHub Desktop.
import Control.Parallel.Strategies
x,y :: Int
x = repeat 0 !! 1000000000
y = repeat 1 !! 1000000000
foo :: Eval Int
foo = do { rpar x; rpar y; return 2 }
{-
% ghci -v0 rpar.hs
ghci> :set +s
ghci> x
0
(1.86 secs, 6061496 bytes)
ghci> y
1
(1.85 secs, 517008 bytes)
ghci> :quit
% ghci -v0 rpar.hs
ghci> :set +s
ghci> runEval foo
2
(1.88 secs, 6644056 bytes)
ghci> x
0
(0.00 secs, 1063952 bytes)
ghci> y
1
(0.00 secs, 1031688 bytes)
-}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment