From c2ce1b178575abc0cc37a6c232502644c9d863ac Mon Sep 17 00:00:00 2001 From: Matthew Pickering Date: Fri, 8 Oct 2021 12:13:31 +0100 Subject: Add GHCi recompilation performance test --- .../perf/compiler/MultiLayerModulesDefsGhci.script | 5 +++++ testsuite/tests/perf/compiler/all.T | 13 +++++++++++ .../tests/perf/compiler/genMultiLayerModulesDefs | 26 ++++++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 testsuite/tests/perf/compiler/MultiLayerModulesDefsGhci.script create mode 100755 testsuite/tests/perf/compiler/genMultiLayerModulesDefs (limited to 'testsuite/tests') diff --git a/testsuite/tests/perf/compiler/MultiLayerModulesDefsGhci.script b/testsuite/tests/perf/compiler/MultiLayerModulesDefsGhci.script new file mode 100644 index 0000000000..e3df435f5d --- /dev/null +++ b/testsuite/tests/perf/compiler/MultiLayerModulesDefsGhci.script @@ -0,0 +1,5 @@ +:l shell.hs +:def shell (\s -> do shell s; return "") +:l MultiLayerModules.hs +:shell find . -name 'Dummy*.hs' -exec sh -c 'echo "" >> {}' \; +:l MultiLayerModules.hs \ No newline at end of file diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index 6876060978..b61ba25478 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -293,6 +293,19 @@ test('MultiLayerModulesRecomp', multimod_compile, ['MultiLayerModules', '-v0']) +test('MultiLayerModulesDefsGhci', + [ collect_compiler_residency(15), + pre_cmd('./genMultiLayerModulesDefs'), + extra_files(['../../ghci/shell.hs', 'genMultiLayerModulesDefs']), + compile_timeout_multiplier(5) + # this is _a lot_ + # but this test has been failing every now and then, + # especially on i386. Let's just give it some room + # to complete successfully reliably everywhere. + ], + ghci_script, + ['MultiLayerModulesDefsGhci.script']) + test('ManyConstructors', [ collect_compiler_stats('bytes allocated',2), pre_cmd('./genManyConstructors'), diff --git a/testsuite/tests/perf/compiler/genMultiLayerModulesDefs b/testsuite/tests/perf/compiler/genMultiLayerModulesDefs new file mode 100755 index 0000000000..8dd1d92fd9 --- /dev/null +++ b/testsuite/tests/perf/compiler/genMultiLayerModulesDefs @@ -0,0 +1,26 @@ +#!/usr/bin/env 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 +# Each module has $DEFS definitions in +# MultiLayerModules.hs imports all the modules from the last layer +DEPTH=3 +WIDTH=3 +DEFS=1000 +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 + for k in $(seq -w 1 $DEFS); do + echo "a_${l}_${i}_${j}_${k} = ${l} + ${i} + ${j} + ${k}" >> 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 -- cgit v1.2.1