Slowdown in concurrent program

Simon Peyton Jones simonpj at microsoft.com
Wed Jan 6 19:59:11 UTC 2016


That sounds bad.  What happens with 8.0?

Big CAFs like [1..40000000] can be problematic... does it happen in the more realistic situation where the bounds are data dependent?

Open a ticket?

Simon

| -----Original Message-----
| From: ghc-devs [mailto:ghc-devs-bounces at haskell.org] On Behalf Of Facundo
| Domínguez
| Sent: 06 January 2016 18:40
| To: ghc-devs at haskell.org
| Subject: Slowdown in concurrent program
| 
| 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
| ghc-devs at haskell.org
| https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2fmail.haskell.
| org%2fcgi-bin%2fmailman%2flistinfo%2fghc-
| devs&data=01%7c01%7csimonpj%40064d.mgd.microsoft.com%7cc87535716ced49a12e3308
| d316c8c028%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=4W%2b0W36E1O%2bZtxzEX
| Besrv%2fUk6fwsvNGc5RqUAwMHDk%3d


More information about the ghc-devs mailing list