:steplocal is orders of magnitude slower than normal interpreter
Summary
It seems that calling :steplocal
on a breakpoint to continue execution of an expression in the ghci debugger takes much much much much longer than executing that expression directly or using :continue
rather than calling step local.
Even though :steplocal
is responsible for stopping at the next breakpoint at the same level as the current one, this slowness makes it unusable.
Steps to reproduce
Fib.hs
:
module Fib where
main = fib 30
fib 0 = 0
fib 1 = 1
fib n = fib (n-1) + fib (n-2)
Run two distinct GHCi sessions on Fib.hs
. On both, :set +s
to output statistics
On the first,
ghci> main
832040
(1.40 secs, 921,592,600 bytes)
On the second,
ghci> :break main
Breakpoint 0 activated at Fib.hs:3:8-13
ghci> main
Stopped in Fib.main, Fib.hs:3:8-13
_result :: Integer = _
(0.00 secs,)
[Fib.hs:3:8-13] ghci> :steplocal
...
..
.
Haven't been able to observe it terminating with this setup.
If we do fib 20
rather than 30
, then the normal execution takes 0.04s
but the :steplocal
one:
- Doesn't say how much time it took, despite having
:set +s
- Takes roughly 6s measured with a stopwatch
I suspect steplocal is doing something asymptotically worse to figure out the "local" part.
Expected behavior
:steplocal
ought to be fast!
Environment
- GHC version used: 9.10