Created
October 9, 2017 18:17
-
-
Save EricWF/e3a15a2a9b0e6f17832ea3c7ce4b8bf0 to your computer and use it in GitHub Desktop.
Benchmark Comparisons
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void BM_Foo(benchmark::State& St) { | |
[...] | |
} | |
static void BM_Bar(benchmark::State& st) { | |
[...] | |
} | |
// Option #1: The BENCHMARK macro could return an identifier that | |
// could be used in comparison API's to setup comparison tests. | |
auto *FooBenchID = BENCHMARK(BM_Foo); | |
auto *BarBenchID = BENCHMARK(BM_Bar)->CompareTo(FooBenchID); | |
// Option #2: A single benchmark function could be used to compare | |
// two algorithms. (Perhaps a single state object could be used). | |
static void BM_Baz(benchmark::State& st1, benchmark::State& st2) { | |
{ // First benchmark | |
while (st1.KeepRunning()) { | |
[...] | |
} | |
} | |
{ // Second benchmark | |
while (st2.KeepRunning()) { | |
[...] | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment