logo       

[ ghc-Bugs-990844 ] conc004.hs mis-optimised (performance weirdness): msg#00011

lang.haskell.glasgow.bugs

Subject: [ ghc-Bugs-990844 ] conc004.hs mis-optimised (performance weirdness)

Bugs item #990844, was opened at 2004-07-14 15:06
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=108032&aid=990844&group_id=8032

Category: Compiler
Group: 6.2.1
Status: Open
Resolution: None
Priority: 5
Submitted By: Remi Turk (remit)
Assigned to: Nobody/Anonymous (nobody)
Summary: conc004.hs mis-optimised (performance weirdness)

Initial Comment:
The following program
(fptools/testsuite/tests/ghc-regress/concurrent/should_run/conc004.hs)
runs about 10 times as slowly when compiled with -O,
both with 6.2.1 and with todays CVS.

% ghc -no-recomp conc004.hs
% time ./a.out
donereal 1.97
user 1.88
sys 0.05

% ghc -no-recomp -O conc004.hs
% time ./a.out
donereal 21.69
user 20.40
sys 0.12


Strange enough, profiling completely reverses this:

% ghc -no-recomp -prof -auto-all conc004.hs
% time ./a.out +RTS -p
donereal 20.23
user 17.81
sys 0.18

total time = 2.10 secs (105 ticks @ 20 ms)
total alloc = 1,116,017,312 bytes (excludes profiling
overheads)

versus

% ghc -no-recomp -prof -auto-all -O conc004.hs
% time ./a.out +RTS -p
donereal 1.35
user 1.31
sys 0.01

total time = 0.94 secs (47 ticks @ 20 ms)
total alloc = 1,060,017,180 bytes (excludes profiling
overheads)


Which seems pretty weird. Except that multithreaded
programs are well known for weird (timing) problems ;o)


module Main where

-- Test thread creation.
-- (from: Einar Wolfgang Karlsen
<ewk@xxxxxxxxxxxxxxxxxxxxxxxx>)

import Control.Concurrent

main :: IO ()
main = do
mvar <- newEmptyMVar

let
spawner :: (IO () -> IO ThreadId) -> Int -> IO ()
spawner c 0 = putMVar mvar ()
spawner c n = do { c (spawner c (n-1)); return ()}

spawner forkIO 1000000
takeMVar mvar
putStr "done"

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=108032&aid=990844&group_id=8032


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise