diff options
author | Bartosz Nitka <niteria@gmail.com> | 2018-01-21 17:16:33 +0000 |
---|---|---|
committer | Bartosz Nitka <niteria@gmail.com> | 2018-01-23 22:56:36 +0000 |
commit | f00ddea96cc856654ac90fcf7d29556a758d6648 (patch) | |
tree | 8ae887a63b1ce77e96941362dad44aa3b3af32e3 | |
parent | 452dee3ff4f385977e56ac0fbb5adf0a90acbcac (diff) | |
download | haskell-f00ddea96cc856654ac90fcf7d29556a758d6648.tar.gz |
Allocate less in plus_mod_dep
This gives a 10% allocation improvement on MultiLayerModules.
The idea is to reuse existing tuples, instead of constantly
constructing new ones.
Test Plan: ./validate
Reviewers: simonpj, bgamari
Reviewed By: simonpj, bgamari
Subscribers: rwbarton, thomie, simonmar, carter
Differential Revision: https://phabricator.haskell.org/D4332
-rw-r--r-- | compiler/typecheck/TcRnTypes.hs | 11 | ||||
-rw-r--r-- | testsuite/tests/perf/compiler/all.T | 3 |
2 files changed, 9 insertions, 5 deletions
diff --git a/compiler/typecheck/TcRnTypes.hs b/compiler/typecheck/TcRnTypes.hs index 00927d7374..aa14b3bcbe 100644 --- a/compiler/typecheck/TcRnTypes.hs +++ b/compiler/typecheck/TcRnTypes.hs @@ -1397,10 +1397,13 @@ plusImportAvails imp_orphs = orphs1 `unionLists` orphs2, imp_finsts = finsts1 `unionLists` finsts2 } where - plus_mod_dep (m1, boot1) (m2, boot2) - = WARN( not (m1 == m2), (ppr m1 <+> ppr m2) $$ (ppr boot1 <+> ppr boot2) ) - -- Check mod-names match - (m1, boot1 && boot2) -- If either side can "see" a non-hi-boot interface, use that + plus_mod_dep r1@(m1, boot1) r2@(m2, boot2) + | ASSERT2( m1 == m2, (ppr m1 <+> ppr m2) $$ (ppr boot1 <+> ppr boot2) ) + boot1 = r2 + | otherwise = r1 + -- If either side can "see" a non-hi-boot interface, use that + -- Reusing existing tuples saves 10% of allocations on test + -- perf/compiler/MultiLayerModules {- ************************************************************************ diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index 51dc6e8a99..431b2889e8 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -1143,10 +1143,11 @@ test('T13379', test('MultiLayerModules', [ compiler_stats_num_field('bytes allocated', - [(wordsize(64), 6294813000, 10), + [(wordsize(64), 5619893176, 10), # initial: 12139116496 # 2017-05-12: 6956533312 Revert "Use a deterministic map for imp_dep_mods" # 2017-05-31: 6294813000 Faster checkFamInstConsistency + # 2018-01-21: 5619893176 Allocate less in plus_mod_dep ]), pre_cmd('./genMultiLayerModules'), extra_files(['genMultiLayerModules']), |