Skip to content

Commit

Permalink
[benchmark] add performance measures
Browse files Browse the repository at this point in the history
  • Loading branch information
FrancoisCarouge committed Aug 11, 2022
1 parent 80ed4a7 commit a7cba2e
Show file tree
Hide file tree
Showing 32 changed files with 16,452 additions and 17 deletions.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ The library supports simple and extended filters. The update equation uses the J
- [Modifiers](#modifiers)
- [Format](#format)
- [Installation](#installation)
- [Performance](#performance)
- [Motivation](#motivation)
- [Resources](#resources)
- [Third Party Acknowledgement](#third-party-acknowledgement)
Expand Down Expand Up @@ -267,7 +268,13 @@ std::string message{ std::format("{}", k) };
# Installation
See installaton instructions in [INSTALL.txt](INSTALL.txt).
See installation instructions in [INSTALL.txt](INSTALL.txt).
# Performance
The [benchmarks](benchmark) share some performance information.
![Float](benchmark/float.svg)
# Motivation
Expand Down
12 changes: 12 additions & 0 deletions benchmark/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Benchmark Results

![Float](float.svg)
![Float 1x1x0](float1x1x0.svg)
![Float 1x1x1](float1x1x1.svg)
![Baseline](baseline.svg)
![Update Float 1x1x0](update1x1x0.svg)
![Update Float 1x1x1](update1x1x1.svg)
![Predict Float 1x1x0](predict1x1x0.svg)
![Predict Float 1x1x1](predict1x1x1.svg)
![Function Call Operator 1x1x0](operator1x1x0.svg)
![Function Call Operator 1x1x1](operator1x1x1.svg)
14 changes: 7 additions & 7 deletions benchmark/benchmark_simple.cpp → benchmark/baseline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ namespace fcarouge::benchmark
{
namespace
{
//! @benchmark Measure performance.
void benchmark_simple(::benchmark::State &state)
//! @benchmark Measure baseline, empty benchmark performance.
void baseline(::benchmark::State &state)
{
for (auto _ : state) {
const auto start{ clock::now() };
::benchmark::ClobberMemory();
const auto start{ clock::now() };

// Measure.
// Nothing to measure but the benchmark.

::benchmark::ClobberMemory();
const auto end{ clock::now() };
Expand All @@ -65,8 +65,8 @@ void benchmark_simple(::benchmark::State &state)
}
}

BENCHMARK(benchmark_simple)
->Name("Benchmark Simple")
BENCHMARK(baseline)
->Name("baseline")
->Unit(::benchmark::kNanosecond)
->ComputeStatistics("min",
[](const auto &results) {
Expand All @@ -77,7 +77,7 @@ BENCHMARK(benchmark_simple)
return std::ranges::max(results);
}) -> UseManualTime()
-> Complexity(::benchmark::oAuto) -> DisplayAggregatesOnly(true)
-> Repetitions(10);
-> Repetitions(100);

} // namespace
} // namespace fcarouge::benchmark
64 changes: 64 additions & 0 deletions benchmark/baseline.plt
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/usr/bin/gnuplot
# _ __ _ __ __ _ _
# | |/ / /\ | | | \/ | /\ | \ | |
# | ' / / \ | | | \ / | / \ | \| |
# | < / /\ \ | | | |\/| | / /\ \ | . ` |
# | . \ / ____ \| |____| | | |/ ____ \| |\ |
# |_|\_\/_/ \_\______|_| |_/_/ \_\_| \_|

# Kalman Filter for C++
# Version 0.1.0
# https://github.com/FrancoisCarouge/Kalman

# SPDX-License-Identifier: Unlicense

# This is free and unencumbered software released into the public domain.

# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
# binary, for any purpose, commercial or non-commercial, and by any
# means.

# In jurisdictions that recognize copyright laws, the author or authors
# of this software dedicate any and all copyright interest in the
# software to the public domain. We make this dedication for the benefit
# of the public at large and to the detriment of our heirs and
# successors. We intend this dedication to be an overt act of
# relinquishment in perpetuity of all present and future rights to this
# software under copyright law.

# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.

# For more information, please refer to <https://unlicense.org>

set terminal svg enhanced background rgb "white" size 360,720
set datafile separator ","
set title "{/:Bold Baseline Benchmark}\n{/*0.8 No code benchmark.}"
set output "baseline.svg"
set key noautotitle
set key inside top left reverse Left
set ylabel "Time (ns)"
set grid ytics
set boxwidth 0.9
set xrange [ -0.5 : 0.5 ]
set style fill solid border linecolor "black"
set yrange [27 : 30]
set ytics .2
set xtics ("Baseline - No Code" 0)

plot "/tmp/baseline.csv" using (0):6 with boxes linecolor rgb "#F7DC6F" title "Maximum", \
"" using (0):1 with boxes linecolor rgb "#F4D03F" title "Average", \
"" using (0):5 with boxes linecolor rgb "#F1C40F" title "Minimum", \
"" using (0):6:(sprintf("%8.2f", $6)) with labels right offset char -2,0.3, \
"" using (0):1:(sprintf("%8.2f", $1)) with labels right offset char -2,0.3, \
"" using (0):5:(sprintf("%8.2f", $5)) with labels right offset char -2,0.3, \
"" using (0):2:3 with yerrorbars linetype 1 linecolor "black" title "Mean and Standard Deviation", \
"" using (0):($2+$3):(sprintf("%.2f", $2+$3)) with labels left offset char 1,0, \
"" using (0):2:(sprintf("%.2f (cv: %.1f %%)", $2, $4 * 100)) with labels left offset char 1,0, \
"" using (0):($2-$3):(sprintf("%.2f", $2-$3)) with labels left offset char 1,0
Loading

0 comments on commit a7cba2e

Please sign in to comment.