diff options
author | Bartosz Nitka <niteria@gmail.com> | 2017-05-15 04:14:01 -0700 |
---|---|---|
committer | Bartosz Nitka <niteria@gmail.com> | 2017-05-15 04:14:53 -0700 |
commit | e527fc2e90958280a36645b6bd0223861cc50a55 (patch) | |
tree | b7b17398228732c53f6833d11448b91302f87d51 /testsuite/tests/perf | |
parent | d5414dd61b540be3b3945c321065a1c70c7962ac (diff) | |
download | haskell-e527fc2e90958280a36645b6bd0223861cc50a55.tar.gz |
Stress test for nested module hierarchies
I'm optimizing a case that is well approximated by
multiple layers of modules where every module in a layer
imports all the modules in the layer below.
It turns out I regressed performance on such cases in 7fea7121.
I'm adding a test case to track improvements and prevent
future regressions.
Test Plan: ./validate
Reviewers: simonmar, austin, bgamari
Reviewed By: simonmar
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3575
Diffstat (limited to 'testsuite/tests/perf')
-rw-r--r-- | testsuite/tests/perf/compiler/all.T | 12 | ||||
-rwxr-xr-x | testsuite/tests/perf/compiler/genMultiLayerModules | 21 |
2 files changed, 33 insertions, 0 deletions
diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index 360bef4702..c90378bbb3 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -1096,3 +1096,15 @@ test('T13379', ], compile, ['']) + +test('MultiLayerModules', + [ compiler_stats_num_field('bytes allocated', + [(wordsize(64), 6956533312, 10), + # initial: 12139116496 + # 2017-05-12: 6956533312 Revert "Use a deterministic map for imp_dep_mods" + ]), + pre_cmd('./genMultiLayerModules'), + extra_files(['genMultiLayerModules']), + ], + multimod_compile, + ['MultiLayerModules', '-v0']) diff --git a/testsuite/tests/perf/compiler/genMultiLayerModules b/testsuite/tests/perf/compiler/genMultiLayerModules new file mode 100755 index 0000000000..b98c481166 --- /dev/null +++ b/testsuite/tests/perf/compiler/genMultiLayerModules @@ -0,0 +1,21 @@ +#!/bin/bash +# Generate $DEPTH layers of modules with $WIDTH modules on each layer +# Every module on layer N imports all the modules on layer N-1 +# MultiLayerModules.hs imports all the modules from the last layer +DEPTH=15 +WIDTH=40 +for i in $(seq -w 1 $WIDTH); do + echo "module DummyLevel0M$i where" > DummyLevel0M$i.hs; +done +for l in $(seq 1 $DEPTH); do + for i in $(seq -w 1 $WIDTH); do + echo "module DummyLevel${l}M$i where" > DummyLevel${l}M$i.hs; + for j in $(seq -w 1 $WIDTH); do + echo "import DummyLevel$((l-1))M$j" >> DummyLevel${l}M$i.hs; + done + done +done +echo "module MultiLayerModules where" > MultiLayerModules.hs +for j in $(seq -w 1 $WIDTH); do + echo "import DummyLevel${DEPTH}M$j" >> MultiLayerModules.hs; +done |