Fix a performance issue with -fprint-expanded-synonyms

Authored by osa1 on May 15 2016, 6:04 AM.

Description

Fix a performance issue with -fprint-expanded-synonyms

The type synonym expander was doing redundant work by looking at same
types again and again. This patch fixes the loop code when both of the
types can be expanded, to do O(min(n, m)) comparisons and O(n + m)
expansions, where n is expansions of the first type and m is
expansions of the second type.

Reported by sjcjoosten in T10547.

Test Plan:
Added a regression test that was taking several minutes to type check
before this patch.

Reviewers: bgamari, simonpj, austin, ezyang

Reviewed By: bgamari, simonpj, austin, ezyang

Subscribers: simonpj, thomie

Differential Revision: https://phabricator.haskell.org/D2198

GHC Trac Issues: Trac #10547

(cherry picked from commit e4834edf4418ace657361649365979e29ebd9daa)

Details

Committed
bgamariAug 26 2016, 9:25 AM
Reviewer
bgamari
Differential Revision
D2198: Fix a performance issue with -fprint-expanded-synonyms
Parents
rGHC57e707821be9: rts/LdvProfile.c: Fix NULL dereference on shutdown
Branches
Unknown
Tags
Unknown