TysWiredIn: Use UniqFM lookup for built-in OccNames
authorBen Gamari <bgamari.foss@gmail.com>
Sat, 9 Jul 2016 19:03:46 +0000 (21:03 +0200)
committerBen Gamari <ben@smart-cactus.org>
Sun, 10 Jul 2016 08:10:51 +0000 (10:10 +0200)
commitf53d761df9762232b54ec57a950d301011cd21f8
treedfba4c9d8f82cbb67e882a886276217e93209bb6
parent0177c85b614618039578d6670453e030eaf49846
TysWiredIn: Use UniqFM lookup for built-in OccNames

Previously we would unpack the OccName into a String, then pattern match
against this string. Due to the implementation of `unpackFS`, this
actually unpacks the entire contents, even though we often only need to
look at the first few characters.

Here we take another approach: build a UniqFM with the known built-in
OccNames, allowing us to use `FastString`'s hash-based comparison
instead.

Reviewers: simonpj, austin, simonmar

Reviewed By: simonmar

Subscribers: thomie

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

GHC Trac Issues: #12357
compiler/prelude/TysWiredIn.hs