ghci balkiness on OS X?

Thomas Hallgren hallgren at chalmers.se
Fri Oct 24 14:23:58 UTC 2014


I have noticed sluggish behaviour in ghci (ghc-7.8.3, OS X 10.9.5). In my case
at least, it seems to be caused by the idle time full garbage collection that
happens after 0.3s of idle time by default.

When you have say 300MB of live data in the heap, a major GC can take 0.5s or
so, and this is very noticeable when it happens as soon as there is more than a
0.3s pause between key strokes.

Foruntately, the idle time GC can be turned off by running ghci +RTS -I0, and
when I do that the problem goes away. Alternatively, using a longer timeout
(e.g. -I2) is enough to prevent the major GCs from happening while you are
typing, so it also helps a lot.

Thomas H


On 2014-10-24 07:37, Judah Jacobson wrote:
> I haven't seen this before myself (running on OS X), though in the past we had a
> report of slowdown in long-running ghci sessions which was hard to reproduce. 
> What versions of GHC and OS X are you using?
> 
> Do you know if this is a problem with text entry in general or only haskeline? 
> If you run the command
> 
> :m +System.IO Control.Exception Control.Monad
> (hSetBuffering stdin NoBuffering >> hSetEcho stdin False >> forever (getChar >>=
> \c -> putStr ['{',c,'}'])) `finally` (hSetEcho stdin True >> hSetBuffering stdin
> LineBuffering)
> 
> and hold down the 'a' key, does it smoothly output "{a}{a}{a}..." or does it
> have similar hiccups?
> 
> -Judah
> 
> 
> 
> On Tue, Oct 21, 2014 at 5:02 PM, Evan Laforge <qdunkan at gmail.com
> <mailto:qdunkan at gmail.com>> wrote:
> 
>     On my OS X, if I load a couple hundred modules into ghci as bytecode,
>     text entry gets balky and laggy.  So e.g. if I hold down a key, the
>     letters will stream in but have frequent hiccups.  This seems to
>     adversely affect haskeline as well, such that, using vi mode,
>     sometimes ^[ to move to command mode will be lost, or it will
>     spontaneously go to insert mode, or ^[ followed by 'h' will be just
>     beep and remain in insert mode.  If I load most of the modules
>     compiled, this doesn't happen, or at least is not nearly so bad.
> 
>     It doesn't seem to be due to background work by ghci or anything,
>     because it doesn't matter how long I wait after loading the modules.
>     My previous random guess was that increased memory use made the GC
>     work more, and my pauses were due to major collections.  But when I
>     try on linux, ghci remains responsive no matter how many modules I
>     load, so maybe it's an OS X only problem.
> 
>     Do any other OS X users see this effect?
>     _______________________________________________
>     Glasgow-haskell-users mailing list
>     Glasgow-haskell-users at haskell.org <mailto:Glasgow-haskell-users at haskell.org>
>     http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
> 
> 
> 
> 
> _______________________________________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users at haskell.org
> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
> 




More information about the Glasgow-haskell-users mailing list