excessive usage of CPU by threadDelay in GHCi

Hello, I have the following simple program: import Control.Concurrent main = threadDelay (10^6) >> main If I run it in GHCi it requires 2-5% of my CPU. If i compile it, it takes 0% of my CPU. It does not matter if I compile -O0, -O2, -threaded, it always uses 0% (which is good). Is it expected that threadDelay should be really expensive in GHCi? Am I doing something wrong? Or should I file a bug? Thanks. - jeremy

Jeremy Shaw wrote:
I have the following simple program:
import Control.Concurrent main = threadDelay (10^6) >> main
If I run it in GHCi it requires 2-5% of my CPU. If i compile it, it takes 0% of my CPU. It does not matter if I compile -O0, -O2, -threaded, it always uses 0% (which is good).
Is it expected that threadDelay should be really expensive in GHCi? Am I doing something wrong? Or should I file a bug?
Please file a bug. It could be that the idle time GC is running repeatedly rather than just once, or something like that. Cheers, Simon
participants (2)
-
Jeremy Shaw
-
Simon Marlow