Skip to content

Commit 32d6b0e

Browse files
authored
Merge pull request simdjson#825 from simdjson/jkeiser/documents-sec
Don't include benchmark overhead in documents/s
2 parents af12066 + 92d7af0 commit 32d6b0e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

benchmark/benchmarker.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ struct benchmarker {
252252
// Statistics about the JSON file independent of its speed (amount of utf-8, structurals, etc.).
253253
// Loaded on first parse.
254254
json_stats* stats;
255-
// Speed and event summary for full parse (not including allocation)
255+
// Speed and event summary for full parse (including allocation, stage 1 and stage 2)
256256
event_aggregate all_stages{};
257257
// Speed and event summary for stage 1
258258
event_aggregate stage1{};
@@ -431,7 +431,7 @@ struct benchmarker {
431431
return 100.0 * a / b;
432432
}
433433

434-
void print(bool tabbed_output, size_t iterations) const {
434+
void print(bool tabbed_output) const {
435435
if (tabbed_output) {
436436
char* filename_copy = (char*)malloc(strlen(filename)+1);
437437
strcpy(filename_copy, filename);
@@ -509,7 +509,7 @@ struct benchmarker {
509509
freqmin, freqmax, freqall);
510510
}
511511
}
512-
printf("\n%.1f documents parsed per second\n", static_cast<double>(iterations)/static_cast<double>(loop.best.elapsed_sec()));
512+
printf("\n%.1f documents parsed per second (best)\n", 1.0/static_cast<double>(all_stages.best.elapsed_sec()));
513513
}
514514
}
515515
};

benchmark/parse.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ int main(int argc, char *argv[]) {
202202
if (!options.verbose) { progress.erase(); }
203203

204204
for (size_t i=0; i<options.files.size(); i++) {
205-
benchmarkers[i]->print(options.tabbed_output, options.iterations);
205+
benchmarkers[i]->print(options.tabbed_output);
206206
delete benchmarkers[i];
207207
}
208208

0 commit comments

Comments
 (0)