blowup in space/time for type checking and object size for high arity tuples
|Reported by:||carter||Owned by:|
|Type of failure:||Compile-time performance bug||Difficulty:||Unknown|
|Test Case:||Blocked By:|
Eric Mertens found a compilation performance issue in how GHC handles type class instance methods with many equality constraints and large arity tuples.
basically using equality constraints to force 62 variables equal, instead of using the same variable for all the tuple slots, make the type checking time go from 0.9 seconds and very little memory to ~20 seconds and ~ 700mb of ram, along with going from ~ 7,000 coercions to 700,000-400,000 coercions, and object file size of 143kb to an object file size of 2.8mb-3.1mb
I'm attaching 2 variants Tuple.hs and NeighborTuple?.hs that exhibit the blowup behavior, and
MonoTuple?.hs (better named PolyTuple?.hs but thats a side detail) that doesn't exhibit the blow up behavior.