summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBartosz Nitka <niteria@gmail.com>2017-05-12 06:38:18 -0700
committerBartosz Nitka <niteria@gmail.com>2017-05-15 04:41:33 -0700
commitffbcffffecf0307ff4dd3173503e2d3387d53386 (patch)
tree1c0e51859e101f39659a183e988173a746d5a007
parent06ad87ef0cc77af05693916decbed72a54906e3f (diff)
downloadhaskell-ffbcffffecf0307ff4dd3173503e2d3387d53386.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 Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3575
-rw-r--r--testsuite/tests/perf/compiler/all.T11
-rwxr-xr-xtestsuite/tests/perf/compiler/genMultiLayerModules21
2 files changed, 32 insertions, 0 deletions
diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T
index 360bef4702..28e1465f4e 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 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