Mark *FB functions INLINE[0] (Fixes #13001)
authorTakano Akio <tak@anoak.io>
Tue, 10 Jan 2017 19:36:00 +0000 (14:36 -0500)
committerBen Gamari <ben@smart-cactus.org>
Tue, 10 Jan 2017 19:36:38 +0000 (14:36 -0500)
commit09bce7accd330e99b1667f8b4eda7def722d6f0c
treecfc8fc62ab052aa70c8c3750eb3452ce723da0d0
parent266a9dc4cd34008f1162eb276032c85ef8371842
Mark *FB functions INLINE[0] (Fixes #13001)

When fusion rules successfully fire, we are left with calls to
*FB functions. They are higher-order functions, and therefore they
often benefit from inlining. This is particularly important when
then final consumer is a strict fold (foldl', length, etc.), because
not inlining these functions means allocating a function closure
for each element in the list, which often is more costly than what
fusion eliminates.

Nofib shows a slight increase in the binary size:

------------------------------------------------------------------------
       Program           Size    Allocs   Runtime   Elapsed  TotalMem
------------------------------------------------------------------------
   gen_regexps          -0.3%      0.0%     0.000     0.000      0.0%
        puzzle          +0.8%      0.0%     0.089     0.090      0.0%
       reptile          +0.8%     -0.0%     0.008     0.008      0.0%
------------------------------------------------------------------------
           Min          -0.3%     -0.0%     -7.3%     -7.1%      0.0%
           Max          +0.8%     +0.0%     +7.8%     +7.7%     +1.8%
Geometric Mean          +0.0%     -0.0%     +0.2%     +0.2%     +0.0%
------------------------------------------------------------------------

Reviewers: simonpj, austin, hvr, bgamari

Reviewed By: simonpj

Subscribers: simonpj, thomie

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

GHC Trac Issues: #13001
libraries/base/Data/Maybe.hs
libraries/base/Data/OldList.hs
libraries/base/GHC/Base.hs
libraries/base/GHC/Enum.hs
libraries/base/GHC/Exts.hs
libraries/base/GHC/List.hs
testsuite/tests/perf/should_run/T13001.hs [new file with mode: 0644]
testsuite/tests/perf/should_run/T13001.stdout [new file with mode: 0644]
testsuite/tests/perf/should_run/all.T