[GHC] #13344: Core string literal patch regresses compiler performance considerably
GHC
ghc-devs at haskell.org
Mon Feb 27 14:41:32 UTC 2017
#13344: Core string literal patch regresses compiler performance considerably
-------------------------------------+-------------------------------------
Reporter: bgamari | Owner: bgamari
Type: bug | Status: new
Priority: high | Milestone: 8.2.1
Component: Compiler | Version: 8.1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: Compile-time | Unknown/Multiple
performance bug | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by bgamari):
Just looking at the interface file sizes between the two trees, it appears
that many files increased by a few hundred bytes with a few (e.g.
`GHC.Show`, `GHC.Generics`) increasing by some kilobytes. For future
reference I performed the comparison with,
{{{#!sh
echo "delta after before file"
paste \
<(ls -l $(find ghc-compare-1/libraries/base/dist-install -iname *.hi)
| awk '{print $5,$9}') \
<(ls -l $(find ghc-compare-2/libraries/base/dist-install -iname *.hi)
| awk '{print $5,$9}') \
| awk '{ print (($1 - $3)), $1, $3, $2}'
| sort -rn | less
}}}
Which results in
{{{
16461 800034 783573 libraries/base/dist-install/build/GHC/Generics.hi
7673 130677 123004 libraries/base/dist-install/build/GHC/RTS/Flags.hi
7555 969695 962140 libraries/base/dist-install/build/Data/Data.hi
7449 103629 96180 libraries/base/dist-install/build/GHC/IO/Exception.hi
7068 268944 261876 libraries/base/dist-install/build/Data/Foldable.hi
6904 136200 129296 libraries/base/dist-install/build/GHC/Show.hi
4830 211720 206890 libraries/base/dist-install/build/Data/Monoid.hi
4767 458028 453261 libraries/base/dist-install/build/Data/Semigroup.hi
4735 498885 494150 libraries/base/dist-install/build/Foreign/C/Types.hi
4651 59316 54665 libraries/base/dist-install/build/GHC/IO/Handle/Types.hi
...
}}}
In the case of `GHC.Generics` we now have things like,
{{{#!hs
$fEqV14 :: [Char]
{- Unfolding: (unpackCString# $fEqV15) -}
$fEqV15 :: Addr#
{- HasNoCafRefs, Unfolding: ("error"#) -}
}}}
Whereas we previously had,
{{{#!hs
$fEqV11 :: [Char]
{- Unfolding: (unpackCString# "error"#) -}
}}}
One potential improvement we can make here (at the expense of some
constant folding opportunities) is to drop the unfoldings from `Addr#`
bindings; afterall, in most cases there is little benefit to inlining the
string literal.
In the case of the `Typeable` bindings, I'm very tempted to just eliminate
unfoldings from all generated `TrName`s. This would likely cut down on
interface file sizes dramatically.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13344#comment:10>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list