From 76f1622e32ae85d3e4fbe2b270a2785b6c02ae25 Mon Sep 17 00:00:00 2001 From: FritzFlorian Date: Mon, 8 Apr 2019 11:06:44 +0200 Subject: [PATCH] Add very simple tool to compare performance impact of current changes --- README.md | 5 ----- app/benchmark_fft/main.cpp | 2 +- compare_benchmarks.py | 44 ++++++++++++++++++++++++++++++++++++++++++++ lib/pls/include/pls/internal/helpers/mini_benchmark.h | 2 +- 4 files changed, 46 insertions(+), 7 deletions(-) create mode 100755 compare_benchmarks.py diff --git a/README.md b/README.md index 9b22f58..d62f410 100644 --- a/README.md +++ b/README.md @@ -42,11 +42,6 @@ Available Settings: - Only one sanitizer can be active at once - Enabling has a performance hit (do not use in releases) -commit | fft(1) | fft(2) ---- | --- | --- -[d2eff7da](https://lab.las3.de/gitlab/las3/development/scheduling/predictable_parallel_patterns/commit/d2eff7dafcd822a4da662c2b4606d504b8545483) | 12.5ms -5.3% | 6.5ms -5.3% - - ### Testing Testing is done using [Catch2](https://github.com/catchorg/Catch2/) diff --git a/app/benchmark_fft/main.cpp b/app/benchmark_fft/main.cpp index 33cbd88..e5f3453 100644 --- a/app/benchmark_fft/main.cpp +++ b/app/benchmark_fft/main.cpp @@ -81,7 +81,7 @@ int main() { pls::internal::helpers::run_mini_benchmark([&] { complex_vector input = initial_input; fft(input.begin(), input.size()); - }, 8); + }, 8, 4000); PROFILE_SAVE("test_profile.prof") } diff --git a/compare_benchmarks.py b/compare_benchmarks.py new file mode 100755 index 0000000..56ebddb --- /dev/null +++ b/compare_benchmarks.py @@ -0,0 +1,44 @@ +#!bin/python3 +import sys +import os + +if len(sys.argv) < 2: + print("Please pass the name of the benchmark target as an argument!") + exit(1) + +target = sys.argv[1] +print('Comparing current modifications for benchmark target ' + target) + +print('Executing current version...') +print(os.popen('cd cmake-build-release; make ' + target).read()) +current = os.popen('chrt -rr 99 ./cmake-build-release/bin/' + target).read() + +print('Executing old version...') +print(os.popen('git stash push').read()) +print(os.popen('cd cmake-build-release; make ' + target).read()) +before = os.popen('chrt -rr 99 ./cmake-build-release/bin/' + target).read() +print(os.popen('git stash pop').read()) + +print('=======================================================') +current = [float(value) for value in current.split(',')] +before = [float(value) for value in before.split(',')] + + +def formate_change(change): + if change > 1.05: + color = '31' + elif change < 0.95: + color = '32' + else: + color = '30' + + return '\033[1;' + color + ';40m %8.2f' % (change * 100) + ' %' + + +format_string = ' '.join(['%10.2f us'] * len(current)) +print('old: ' + format_string % tuple(before)) +print('new: ' + format_string % tuple(current)) +print('=' * 55) +change = [c / b for b, c in zip(before, current)] +formated_change = ''.join(list(map(formate_change, change))) +print(formated_change) diff --git a/lib/pls/include/pls/internal/helpers/mini_benchmark.h b/lib/pls/include/pls/internal/helpers/mini_benchmark.h index c3742ad..d153a32 100644 --- a/lib/pls/include/pls/internal/helpers/mini_benchmark.h +++ b/lib/pls/include/pls/internal/helpers/mini_benchmark.h @@ -41,7 +41,7 @@ namespace pls { std::cout << time_per_iteration; if (num_threads < max_threads) { - std::cout << ", "; + std::cout << ","; } } std::cout << std::endl; -- libgit2 0.26.0