a compiled program is slower than byte code

Kazu Yamamoto ( 山本和彦 ) kazu at iij.ad.jp
Mon Feb 7 03:27:46 CET 2011


Hello, 

If I compile the attach code with GHC of the newest ghc-7.0 darcs
branch, the compiled program is much slower than byte code. This
phenomenon does not exist in GHC 6.12.3.

6.12.3  runghc   -- 6.23s user 0.59s system 98% cpu 6.912 total
        ghc      -- 5.72s user 0.70s system 99% cpu 6.422 total
        ghc -O   -- 5.70s user 0.67s system 99% cpu 6.376 total
        ghc -O2  -- 5.69s user 0.67s system 99% cpu 6.373 total

ghc-7.0 runghc   -- 6.43s user 0.10s system 99% cpu 6.593 total
        ghc      -- 9.20s user 0.09s system 99% cpu 9.302 total
        ghc -O   -- 9.20s user 0.09s system 99% cpu 9.298 total
        ghc -O2  -- 9.38s user 0.09s system 99% cpu 9.478 total

Is this a bug?

My environment is Mac which runs Snow Leopard.

--Kazu

----
import System.IO

n :: Int
n = 10000

main :: IO ()
main = withFile "/dev/null" WriteMode $ \h ->
    hPutStr h . foldr1 (++) . replicate n . replicate n $ 'a'
----



More information about the Glasgow-haskell-users mailing list