Note [ModuleEnv performance and determinism]
To prevent accidental reintroduction of nondeterminism the Ord instance for Module was changed to not depend on Unique ordering and to use the lexicographic order. This is potentially expensive, but when measured there was no difference in performance. To be on the safe side and not pessimize ModuleEnv uses nondeterministic ordering on Module and normalizes by doing the lexicographic sort when turning the env to a list. See Note [Unique Determinism] for more information about the source of nondeterminism and Note [Deterministic UniqFM] for explanation of why it matters for maps.
References 2
- Deterministic UniqFM GHC.Types.Unique.DFM
- Unique Determinism GHC.Types.Unique
Referenced by 4
- GHC.Unit.Module.Env call site ×3
- GHC.Tc.Instance.Family call site