Order of constructors in Data.Map.Internal

chessai . chessai1996 at gmail.com
Mon Jan 28 21:43:40 UTC 2019


When looking through the source of Data.Map.Internal, there's a note:

-- [Note: Order of constructors]
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- The order of constructors of Map matters when considering performance.
-- Currently in GHC 7.0, when type has 2 constructors, a forward conditional
-- jump is made when successfully matching second constructor. Successful match
-- of first constructor results in the forward jump not taken.
-- On GHC 7.0, reordering constructors from Tip | Bin to Bin | Tip
-- improves the benchmark by up to 10% on x86.

I've been curious about this for a while now. GHC 7.0 was released
quite a long time ago, so I wonder if this is still the case? David
might know.


More information about the Libraries mailing list