on master help sign in
Show: Activate literal rewrite rules in simplifier phase 1

When rewriting in a rule, GHC pretends that it is in the phase given by the activation phase of the rule (see Note [Simplifying inside stable unfoldings] in `SimplUtils` for rationale). This means that while rewriting the text literal rules, the simplifier is effectively in phase 2 due to 86ddf8a9dd29d9548bec2e253f1793dc5f346a05. As it turns out, the `build` rule provided by `base` is also active in phase 2, meaning it still competes with the literal rules (as 7.10.2 uses it to rewrite the LHS). For this reason, the previous change did not resolve the performance issue in 7.10.2; something I did not previously catch due to a rather silly issue in my test envirionment. This issue is now properly resolved by activating the literal rewrite rules only in phase 1, by which point the `build` rule is inactive. See comments 22 through 25 in GHC Trac #10528 for details.

commit9b01539fa849cee05971409a9317fb88d126570d authorBen Gamari <ben@smart-cactus.org> dateThu 30 Jul 2015, 12:12 (11 years ago) parent53c968d
1 file changed+4−4
Data/Text/Show.hs+4−4
Data/Text/Show.hs+4−4
@@ -50,19 +50,19 @@ unpackCString# :: Addr# -> Text
5050unpackCString# addr# = unstream (S.streamCString# addr#)
5151{-# NOINLINE unpackCString# #-}
5252
53−{-# RULES "TEXT literal" [2] forall a.
53+{-# RULES "TEXT literal" [1] forall a.
5454 unstream (S.map safe (S.streamList (GHC.unpackCString# a)))
5555 = unpackCString# a #-}
5656
57−{-# RULES "TEXT literal UTF8" [2] forall a.
57+{-# RULES "TEXT literal UTF8" [1] forall a.
5858 unstream (S.map safe (S.streamList (GHC.unpackCStringUtf8# a)))
5959 = unpackCString# a #-}
6060
61−{-# RULES "TEXT empty literal" [2]
61+{-# RULES "TEXT empty literal" [1]
6262 unstream (S.map safe (S.streamList []))
6363 = empty_ #-}
6464
65−{-# RULES "TEXT singleton literal" [2] forall a.
65+{-# RULES "TEXT singleton literal" [1] forall a.
6666 unstream (S.map safe (S.streamList [a]))
6767 = singleton_ a #-}
6868