UniqSet: Implement unionManyUniqSets in terms of foldl' instead of foldr
authorBen Gamari <bgamari.foss@gmail.com>
Tue, 24 Jan 2017 17:50:00 +0000 (12:50 -0500)
committerBen Gamari <ben@smart-cactus.org>
Tue, 24 Jan 2017 21:07:34 +0000 (16:07 -0500)
commitdeb75cbf6741d84859eb256f1773807b099ca12f
tree30d93e73b68d8231ecdbb93e03ace453b0b23e77
parent99f818282673c9946a162c1727c4cecada76ddee
UniqSet: Implement unionManyUniqSets in terms of foldl' instead of foldr

foldr generally isn't a good choice for folds where the result can't be
consumed incrementally. This gives a very modest improvement in
compiler allocations,
```
        -1 s.d.                -----          -0.182%
        +1 s.d.                -----          -0.050%
        Average                -----          -0.116%
```
This is clearly semantics-preserving since we are constructing a set.

Test Plan: Validate

Reviewers: austin

Subscribers: dfeuer, thomie

Differential Revision: https://phabricator.haskell.org/D2965
compiler/utils/UniqSet.hs