mirror of
https://github.com/nlohmann/json.git
synced 2024-11-28 09:09:02 +08:00
Add benchmark for small integers
This benchmark is a sample of 1 million "small" integers in range [-1000000 1000000) sampled from uniform distribution.
This commit is contained in:
parent
6503e83e74
commit
be9b4cbd60
@ -19,6 +19,7 @@ file(COPY ${CMAKE_SOURCE_DIR}/data DESTINATION .)
|
|||||||
file(COPY ${CMAKE_SOURCE_DIR}/../test/data/regression/floats.json
|
file(COPY ${CMAKE_SOURCE_DIR}/../test/data/regression/floats.json
|
||||||
${CMAKE_SOURCE_DIR}/../test/data/regression/unsigned_ints.json
|
${CMAKE_SOURCE_DIR}/../test/data/regression/unsigned_ints.json
|
||||||
${CMAKE_SOURCE_DIR}/../test/data/regression/signed_ints.json
|
${CMAKE_SOURCE_DIR}/../test/data/regression/signed_ints.json
|
||||||
|
${CMAKE_SOURCE_DIR}/../test/data/regression/small_signed_ints.json
|
||||||
DESTINATION data/numbers)
|
DESTINATION data/numbers)
|
||||||
|
|
||||||
# benchmark binary
|
# benchmark binary
|
||||||
|
@ -35,7 +35,7 @@ BENCHMARK_CAPTURE(ParseFile, twitter, "data/nativejson-benchmark/twitter.j
|
|||||||
BENCHMARK_CAPTURE(ParseFile, floats, "data/numbers/floats.json");
|
BENCHMARK_CAPTURE(ParseFile, floats, "data/numbers/floats.json");
|
||||||
BENCHMARK_CAPTURE(ParseFile, signed_ints, "data/numbers/signed_ints.json");
|
BENCHMARK_CAPTURE(ParseFile, signed_ints, "data/numbers/signed_ints.json");
|
||||||
BENCHMARK_CAPTURE(ParseFile, unsigned_ints, "data/numbers/unsigned_ints.json");
|
BENCHMARK_CAPTURE(ParseFile, unsigned_ints, "data/numbers/unsigned_ints.json");
|
||||||
|
BENCHMARK_CAPTURE(ParseFile, small_signed_ints, "data/numbers/small_signed_ints.json");
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
// parse JSON from string
|
// parse JSON from string
|
||||||
@ -68,6 +68,7 @@ BENCHMARK_CAPTURE(ParseString, twitter, "data/nativejson-benchmark/twitter
|
|||||||
BENCHMARK_CAPTURE(ParseString, floats, "data/numbers/floats.json");
|
BENCHMARK_CAPTURE(ParseString, floats, "data/numbers/floats.json");
|
||||||
BENCHMARK_CAPTURE(ParseString, signed_ints, "data/numbers/signed_ints.json");
|
BENCHMARK_CAPTURE(ParseString, signed_ints, "data/numbers/signed_ints.json");
|
||||||
BENCHMARK_CAPTURE(ParseString, unsigned_ints, "data/numbers/unsigned_ints.json");
|
BENCHMARK_CAPTURE(ParseString, unsigned_ints, "data/numbers/unsigned_ints.json");
|
||||||
|
BENCHMARK_CAPTURE(ParseString, small_signed_ints, "data/numbers/small_signed_ints.json");
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
@ -101,6 +102,8 @@ BENCHMARK_CAPTURE(Dump, signed_ints / -, "data/numbers/signed_ints.json",
|
|||||||
BENCHMARK_CAPTURE(Dump, signed_ints / 4, "data/numbers/signed_ints.json", 4);
|
BENCHMARK_CAPTURE(Dump, signed_ints / 4, "data/numbers/signed_ints.json", 4);
|
||||||
BENCHMARK_CAPTURE(Dump, unsigned_ints / -, "data/numbers/unsigned_ints.json", -1);
|
BENCHMARK_CAPTURE(Dump, unsigned_ints / -, "data/numbers/unsigned_ints.json", -1);
|
||||||
BENCHMARK_CAPTURE(Dump, unsigned_ints / 4, "data/numbers/unsigned_ints.json", 4);
|
BENCHMARK_CAPTURE(Dump, unsigned_ints / 4, "data/numbers/unsigned_ints.json", 4);
|
||||||
|
BENCHMARK_CAPTURE(Dump, small_signed_ints / -, "data/numbers/small_signed_ints.json", -1);
|
||||||
|
BENCHMARK_CAPTURE(Dump, small_signed_ints / 4, "data/numbers/small_signed_ints.json", 4);
|
||||||
|
|
||||||
|
|
||||||
BENCHMARK_MAIN();
|
BENCHMARK_MAIN();
|
||||||
|
1000002
test/data/regression/small_signed_ints.json
Executable file
1000002
test/data/regression/small_signed_ints.json
Executable file
File diff suppressed because it is too large
Load Diff
@ -669,7 +669,8 @@ TEST_CASE("regression tests")
|
|||||||
{
|
{
|
||||||
"test/data/regression/floats.json",
|
"test/data/regression/floats.json",
|
||||||
"test/data/regression/signed_ints.json",
|
"test/data/regression/signed_ints.json",
|
||||||
"test/data/regression/unsigned_ints.json"
|
"test/data/regression/unsigned_ints.json",
|
||||||
|
"test/data/regression/small_signed_ints.json"
|
||||||
})
|
})
|
||||||
{
|
{
|
||||||
CAPTURE(filename)
|
CAPTURE(filename)
|
||||||
|
Loading…
Reference in New Issue
Block a user