Improve wrapTicks performance with lots of redundant source notes
Improve wrapTicks performance with lots of redundant source notes

The old version had O(n^3) performance for n non-overlapping source
notes and let floats each, which is exactly what happens with -g if we
compile a list literal of length n.

The idea here is simply to establish early which source notes will
actually survive (e.g. use a left fold). The new code should be O(n) for
list literals.

Reviewers: austin, dfeuer, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

GHC Trac Issues: #11095

ezyang/ghc,sdiehl/ghc,shlevy/ghc,ezyang/ghc,shlevy/ghc,sdiehl/ghc,ezyang/ghc,ezyang/ghc,sdiehl/ghc,shlevy/ghc,sdiehl/ghc,shlevy/ghc,sdiehl/ghc,shlevy/ghc,ezyang/ghc,sdiehl/ghc,shlevy/ghc,ezyang/ghc,shlevy/ghc,ezyang/ghc,sdiehl/ghc