Commit f00ddea9 authored by niteria's avatar niteria

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
parent 452dee3f
......@@ -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
{-
************************************************************************
......
......@@ -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']),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment