Skip to content

matchInstEnv accounts for 50% of typechecker time

2022-01-11-120537_1838x781

I created a profile of GHC compiling a large commercial project and noticed that matchInstEnv accounted for 50% of time spent typechecking the project. That seems like rather a lot. Zooming into just matchInstEnv..

2022-01-11-120754_1917x288

It seems that the cost is split quite evenly between tc_unify_tys_fg, tc_match_tys and $instIsVisible, instIsVisible looks quite cheap so I wondered if this function is getting hammered an ungodly number of times.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information