[commit: ghc] master: Stress test for nested module hierarchies (ffbcfff)
git at git.haskell.org
git at git.haskell.org
Mon May 15 11:41:49 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/ffbcffffecf0307ff4dd3173503e2d3387d53386/ghc
>---------------------------------------------------------------
commit ffbcffffecf0307ff4dd3173503e2d3387d53386
Author: Bartosz Nitka <niteria at gmail.com>
Date: Fri May 12 06:38:18 2017 -0700
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
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3575
>---------------------------------------------------------------
ffbcffffecf0307ff4dd3173503e2d3387d53386
testsuite/tests/perf/compiler/all.T | 11 +++++++++++
testsuite/tests/perf/compiler/genMultiLayerModules | 21 +++++++++++++++++++++
2 files changed, 32 insertions(+)
diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T
index 360bef4..28e1465 100644
--- a/testsuite/tests/perf/compiler/all.T
+++ b/testsuite/tests/perf/compiler/all.T
@@ -1096,3 +1096,14 @@ test('T13379',
],
compile,
[''])
+
+test('MultiLayerModules',
+ [ compiler_stats_num_field('bytes allocated',
+ [(wordsize(64), 12139116496, 10),
+ # initial: 12139116496
+ ]),
+ 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 0000000..b98c481
--- /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
More information about the ghc-commits
mailing list