Search
Improvements to the ghc-debug terminal interface
ghc-debug
is a debugging tool for performing precise heap analysis of Haskell programs (check out our previous post introducing it). While working on Eras Profiling, we took the opportunity to make some much needed improvements and quality of life fixes to both the ghc-debug
library and the https://hackage.haskell.org/package/ghc-debug-brick
terminal user interface.
To summarise,
ghc-debug
now works seamlessly with profiled executables.- The
ghc-debug-brick
UI has been redesigned around a composable, filter based workflow. - Cost centers and other profiling metadata can now be inspected using both the library interface and the TUI.
- More analysis modes have been integrated into the terminal interface such as the 2-level profile.
This post explores the changes and the new possibilities for inspecting the heap of Haskell processes that they enable. These changes are available by using the 0.6.0.0
version of
https://hackage.haskell.org/package/ghc-debug-stub and https://hackage.haskell.org/package/ghc-debug-brick-0.6.0.0.
Choreographing a dance with the GHC specializer (Part 1)
This is the first of a two-part series of blog posts on GHC specialization, an optimization technique used by GHC to eliminate the performance overhead of ad-hoc polymorphism and enable other powerful optimizations. There will also be a Haskell Unfolder episode about this topic.
GHC activities report: December 2023–February 2024
Read about the latest GHC development activity in this report from Well-Typed.
When "blocked indefinitely" is not indefinite
Consider a Haskell thread trying to read from a TMVar
:
``` x <- atomically $ takeTMVar v
```
If the TMVar
is currently empty and there are no other threads that could write to the TMVar
, then this thread will never be able to make progress. The GHC runtime detects such situations, and this call to atomically
will throw a BlockedIndefinitelyOnSTM
exception, rendered as
``` thread blocked indefinitely in an STM transaction
```
Occasionally, however, the runtime will throw this exception even when progress is possible.
Reducing Haddock's Memory Usage
Haddock is the documentation generation tool for Haskell.
Recently, Mercury asked us to investigate performance problems in Haddock that were preventing their developers from using it effectively.
At a high level, the work covered by this post has resulted in Haddock’s memory usage being roughly halved. The full set of Haddock and GHC changes resulting in these improvements will be shipped with GHC 9.8.
All this profiling and debugging work was completed using the eventlog2html
and ghc-debug
tools.