Dear devs,
  The following program shows worse measures when compiled with -O
with both ghc-7.10.2 and ghc-7.8.3.

  Am I hitting a known bug? Or may someone point a mistake in the code?

  It also shows worse measures when using anything other than -N1.

Thanks in advance,
Facundo

-- /opt/ghc-7.8.3/bin/ghc --make -threaded -fforce-recomp test.hs
-- time ./test: 10 seconds
--
-- /opt/ghc-7.8.3/bin/ghc --make -threaded -O -fforce-recomp test.hs
-- time ./test: 48 seconds
--
-- /opt/ghc-7.10.2/bin/ghc --make -threaded -fforce-recomp test.hs
-- time ./test: 23 seconds
--
-- /opt/ghc-7.10.2/bin/ghc --make -threaded -O -fforce-recomp test.hs
-- time ./test: 57 seconds
--

import Control.Concurrent
import Control.Monad
import Data.List


main :: IO ()
main = do
  let xs = [ 1 .. 400000000]
  mv <- newEmptyMVar
  replicateM_ 4 $ forkIO $ putMVar mv $! foldl' (+) 0 xs
  nums <- replicateM 4 $ takeMVar mv
  print (nums :: [Integer])
_______________________________________________
ghc-devs mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

Reply via email to