diff options
author | David Eichmann <davide@Well-Typed.com> | 2018-11-07 12:02:47 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-11-07 12:07:11 -0500 |
commit | 932cd41d8c7984c767c1b3b58e05146f69cc5c15 (patch) | |
tree | 41e77f048036a19100c5bee508c77b2ab8ec55d4 /libraries | |
parent | 82a5c2410a47b16df09039b9786c2c0e34ba130e (diff) | |
download | haskell-932cd41d8c7984c767c1b3b58e05146f69cc5c15.tar.gz |
testsuite: Save performance metrics in git notes.
This patch makes the following improvement:
- Automatically records test metrics (per test environment) so that
the programmer need not supply nor update expected values in *.T
files.
- On expected metric changes, the programmer need only indicate the
direction of change in the git commit message.
- Provides a simple python tool "perf_notes.py" to compare metrics
over time.
Issues:
- Using just the previous commit allows performance to drift with each
commit.
- Currently we allow drift as we have a preference for minimizing
false positives.
- Some possible alternatives include:
- Use metrics from a fixed commit per test: the last commit that
allowed a change in performance (else the oldest metric)
- Or use some sort of aggregate since the last commit that allowed
a change in performance (else all available metrics)
- These alternatives may result in a performance issue (with the
test driver) having to heavily search git commits/notes.
- Run locally, performance tests will trivially pass unless the tests
were run locally on the previous commit. This is often not the case
e.g. after pulling recent changes.
Previously, *.T files contain statements such as:
```
stats_num_field('peak_megabytes_allocated', (2, 1))
compiler_stats_num_field('bytes allocated',
[(wordsize(64), 165890392, 10)])
```
This required the programmer to give the expected values and a tolerance
deviation (percentage). With this patch, the above statements are
replaced with:
```
collect_stats('peak_megabytes_allocated', 5)
collect_compiler_stats('bytes allocated', 10)
```
So that programmer must only enter which metrics to test and a tolerance
deviation. No expected value is required. CircleCI will then run the
tests per test environment and record the metrics to a git note for that
commit and push them to the git.haskell.org ghc repo. Metrics will be
compared to the previous commit. If they are different by the tolerance
deviation from the *.T file, then the corresponding test will fail. By
adding to the git commit message e.g.
```
# Metric (In|De)crease <metric(s)> <options>: <tests>
Metric Increase ['bytes allocated', 'peak_megabytes_allocated'] \
(test_env='linux_x86', way='default'):
Test012, Test345
Metric Decrease 'bytes allocated':
Test678
Metric Increase:
Test711
```
This will allow the noted changes (letting the test pass). Note that by
omitting metrics or options, the change will apply to all possible
metrics/options (i.e. in the above, an increase for all metrics in all
test environments is allowed for Test711)
phabricator will use the message in the description
Reviewers: bgamari, hvr
Reviewed By: bgamari
Subscribers: rwbarton, carter
GHC Trac Issues: #12758
Differential Revision: https://phabricator.haskell.org/D5059
Diffstat (limited to 'libraries')
-rw-r--r-- | libraries/base/tests/all.T | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/libraries/base/tests/all.T b/libraries/base/tests/all.T index 90af9020d6..aaf4aa2789 100644 --- a/libraries/base/tests/all.T +++ b/libraries/base/tests/all.T @@ -176,12 +176,7 @@ test('topHandler04', test('T8766', - [ stats_num_field('bytes allocated', - [ (wordsize(64), 16828144, 5) - # with GHC-7.6.3: 83937384 (but faster execution than the next line) - # before: 58771216 (without call-arity-analysis) - # expected value: 16828144 (2014-01-14) - , (wordsize(32), 8433644, 5) ]) + [ collect_stats('bytes allocated',5) , only_ways(['normal'])], compile_and_run, ['-O']) @@ -208,9 +203,7 @@ test('T8089', test('T8684', expect_broken(8684), compile_and_run, ['']) test('T9826',normal, compile_and_run,['']) test('T9848', - [ stats_num_field('bytes allocated', - [ (wordsize(64), 51840, 20) - , (wordsize(32), 47348, 20) ]) + [ collect_stats('bytes allocated') , only_ways(['normal'])], compile_and_run, ['-O']) @@ -223,10 +216,7 @@ test('lazySTexamples', normal, compile_and_run, ['']) test('T11760', req_smp, compile_and_run, ['-threaded -with-rtsopts=-N2']) test('T12874', normal, compile_and_run, ['']) test('T13191', - [ stats_num_field('bytes allocated', - [ (wordsize(64), 185943272, 5) ]) - # with GHC-8.1 before liftA2 change: 325065128 - # GHC-8.1 with custom liftA2: 185943272 + [ collect_stats('bytes allocated', 5) , only_ways(['normal'])], compile_and_run, ['-O']) @@ -234,7 +224,7 @@ test('T13525', when(opsys('mingw32'), skip), compile_and_run, ['']) test('T13097', normal, compile_and_run, ['']) test('functorOperators', normal, compile_and_run, ['']) test('T3474', - [stats_num_field('max_bytes_used', [ (wordsize(64), 44504, 5) ]), + [collect_stats('max_bytes_used',5), only_ways(['normal'])], compile_and_run, ['-O']) test('T14425', normal, compile_and_run, ['']) |