Regression in concurrency performance from ghc 6.6 to 6.8
While most Great Language Shootout benchmarks are running noticeably (10-20+ %) faster with GHC 6.8.1, benchmarks for concurrency seem to consistently be running slower, on a variety of architectures.
Attached are some example programs from the shootout where performance has worsened.
The thread-ring benchmark:
import Control.Monad
import Control.Concurrent
import System.Environment
ring = 503
new l i = do
r <- newEmptyMVar
forkIO (thread i l r)
return r
thread :: Int -> MVar Int -> MVar Int -> IO ()
thread i l r = go
where go = do
m <- takeMVar l
when (m == 1) (print i)
putMVar r $! m - 1
when (m > 0) go
main = do
a <- newMVar . read . head =<< getArgs
z <- foldM new a [2..ring]
thread 1 z a
We can benchmark this as follows:
$ ghc-6.8.1 -O2 threadring.hs -o ghc68 -no-recomp
$ ghc-6.6.1 -O2 threadring.hs -o ghc66 -no-recomp
$ time ./ghc68 30000000 ; time ./ghc66 30000000
75
./ghc68 30000000 4.98s user 0.05s system 100% cpu 5.030 total
75
./ghc66 30000000 4.58s user 0.04s system 99% cpu 4.643 total
'chameneos' is another that has got slower.
http://shootout.alioth.debian.org/gp4/benchmark.php?test=chameneos&lang=ghc&id=2
$ time ./ghc66 7000000 ; time ./ghc68 7000000
14000000
./ghc66 7000000 3.36s user 0.05s system 99% cpu 3.425 total
14000000
./ghc68 7000000 3.75s user 0.06s system 99% cpu 3.815 total
Trac metadata
| Trac field | Value |
|---|---|
| Version | 6.8.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Runtime System |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | dons@galois.com, sjanssen@cse.unl.edu |
| Operating system | Multiple |
| Architecture | Multiple |