From 92d7af0881daa525a4fd950bb720fae120eb7c88 Mon Sep 17 00:00:00 2001 From: John Keiser Date: Tue, 28 Apr 2020 12:53:33 -0700 Subject: [PATCH] Don't include benchmark overhead in documents/s --- benchmark/benchmarker.h | 6 +++--- benchmark/parse.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/benchmark/benchmarker.h b/benchmark/benchmarker.h index 3e7421e2f..c01dcda3e 100644 --- a/benchmark/benchmarker.h +++ b/benchmark/benchmarker.h @@ -252,7 +252,7 @@ struct benchmarker { // Statistics about the JSON file independent of its speed (amount of utf-8, structurals, etc.). // Loaded on first parse. json_stats* stats; - // Speed and event summary for full parse (not including allocation) + // Speed and event summary for full parse (including allocation, stage 1 and stage 2) event_aggregate all_stages{}; // Speed and event summary for stage 1 event_aggregate stage1{}; @@ -431,7 +431,7 @@ struct benchmarker { return 100.0 * a / b; } - void print(bool tabbed_output, size_t iterations) const { + void print(bool tabbed_output) const { if (tabbed_output) { char* filename_copy = (char*)malloc(strlen(filename)+1); strcpy(filename_copy, filename); @@ -509,7 +509,7 @@ struct benchmarker { freqmin, freqmax, freqall); } } - printf("\n%.1f documents parsed per second\n", static_cast(iterations)/static_cast(loop.best.elapsed_sec())); + printf("\n%.1f documents parsed per second (best)\n", 1.0/static_cast(all_stages.best.elapsed_sec())); } } }; diff --git a/benchmark/parse.cpp b/benchmark/parse.cpp index 7b8c441bf..56b38c481 100644 --- a/benchmark/parse.cpp +++ b/benchmark/parse.cpp @@ -202,7 +202,7 @@ int main(int argc, char *argv[]) { if (!options.verbose) { progress.erase(); } for (size_t i=0; iprint(options.tabbed_output, options.iterations); + benchmarkers[i]->print(options.tabbed_output); delete benchmarkers[i]; }