
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?

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
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@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

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
mailto:qdunkan@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@haskell.org mailto:Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

On Fri, Oct 24, 2014 at 7:23 AM, Thomas Hallgren
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.
Aha, +RTS -I0 does the trick! I'll bet it messes up haskeline because
the sudden delays cause it to time out between keystrokes. But with
that flag, it stays responsive no matter how many modules I have
loaded. Thanks.
I wonder why I can only get this to happen on OS X? Maybe the linux
machine just has faster memory and can get through the GC quicker?
Anyway, I wonder if disabling idle GC would make sense for ghci in
general? ghci, unlike a normal program, is unlikely to be doing
background work while its waiting on the prompt, so there is no new
garbage for the GC to detect. Also, input latency is very noticeable,
though I suppose that goes for all interactive programs. In fact I'm
tempted to try this on my interactive program.
On Thu, Oct 23, 2014 at 10:37 PM, Judah Jacobson
and hold down the 'a' key, does it smoothly output "{a}{a}{a}..." or does it have similar hiccups?
I get hiccups, though they're usually after I pause for a bit. This is consistent with the "idle GC" theory, so I think that was probably the problem.
participants (3)
-
Evan Laforge
-
Judah Jacobson
-
Thomas Hallgren