getLevity allocates too much for what it does.
Looking at a ghc profile I noticed that getLevity
was accountable for about 0.5% of all allocations for an -O2 build. Which seemed far too high.
After a brief chat with @sheaf we noticed that its call to splitTyConApp_maybe was allocating a lot of intermediate data structures that were not really needed by the use in getLevity.
I will post a patch with the perf improvement shortly.