This will change the default of the parse benchmark so that it work over hot buffers (#827)

* This will change the default of the parse benchmark so that it work over hot buffers
by default, thus omitting memory allocation as part of the benchmark.

* Everyone should be using '-H' from now on.
This commit is contained in:
Daniel Lemire 2020-04-29 10:43:27 -07:00 committed by GitHub
parent 76b0bfa7f5
commit 4cd9de5c37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 4 deletions

View File

@ -84,7 +84,7 @@ if (Git_FOUND)
add_test(
NAME checkperf
# COMMAND ECHO $<TARGET_FILE:perfdiff> \"$<TARGET_FILE:parse> -t ${SIMDJSON_CHECKPERF_ARGS}\" \"${CHECKPERF_PARSE} -t ${SIMDJSON_CHECKPERF_ARGS}\" }
COMMAND $<TARGET_FILE:perfdiff> $<TARGET_FILE:parse> ${CHECKPERF_PARSE} -t ${SIMDJSON_CHECKPERF_ARGS}
COMMAND $<TARGET_FILE:perfdiff> $<TARGET_FILE:parse> ${CHECKPERF_PARSE} -H -t ${SIMDJSON_CHECKPERF_ARGS}
)
set_property(TEST checkperf APPEND PROPERTY LABELS per_implementation)
set_property(TEST checkperf APPEND PROPERTY DEPENDS parse perfdiff ${SIMDJSON_USER_CMAKECACHE})

View File

@ -62,7 +62,8 @@ void print_usage(ostream& out) {
out << "-v - Verbose output." << endl;
out << "-s stage1 - Stop after find_structural_bits." << endl;
out << "-s all - Run all stages." << endl;
out << "-H - Make the buffers hot (reduce page allocation during parsing)" << endl;
out << "-C - Leave the buffers cold (includes page allocation and related OS tasks during parsing, speed tied to OS performance)" << endl;
out << "-H - Make the buffers hot (reduce page allocation and related OS tasks during parsing) [default]" << endl;
out << "-a IMPL - Use the given parser implementation. By default, detects the most advanced" << endl;
out << " implementation supported on the host machine." << endl;
for (auto impl : simdjson::available_implementations) {
@ -86,12 +87,19 @@ struct option_struct {
bool verbose = false;
bool tabbed_output = false;
bool hotbuffers = false;
/**
* Benchmarking on a cold parser instance means that the parsing may include
* memory allocation at the OS level. This may lead to apparently odd results
* such that higher speed under the Windows Subsystem for Linux than under the
* regular Windows, for the same machine. It is arguably misleading to benchmark
* how the OS allocates memory, when we really want to just benchmark simdjson.
*/
bool hotbuffers = true;
option_struct(int argc, char **argv) {
int c;
while ((c = getopt(argc, argv, "vtn:i:a:s:H")) != -1) {
while ((c = getopt(argc, argv, "vtn:i:a:s:HC")) != -1) {
switch (c) {
case 'n':
iterations = atoi(optarg);
@ -118,6 +126,9 @@ struct option_struct {
simdjson::active_implementation = impl;
break;
}
case 'C':
hotbuffers = false;
break;
case 'H':
hotbuffers = true;
break;