Skip to content

Commit

Permalink
Some tweaks to json perf tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lefticus committed May 21, 2024
1 parent caa3c1d commit 099a670
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions PMR/json_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,15 @@ static void Boost_JSON_PMR_Monotonic_Winkout_Parse(benchmark::State &state, std:
}

// Your homework: get this compiling and working so that PMR permeates the json parser when desired
// static void nlohmann_JSON_PMR(benchmark::State &state)
// {
// using pmr_json = nlohmann::basic_json<std::map, std::vector, std::pmr::string, bool, std::int64_t, std::uint64_t, double, std::pmr::polymorphic_allocator>;
// auto s = load_file("citm_catalog.json");
// for (auto _ : state) {
// auto jv = pmr_json::parse(s.begin(), s.end());
// }
// }
// BENCHMARK(nlohmann_JSON_PMR);
static void nlohmann_JSON_PMR(benchmark::State &state)
{
using pmr_json = nlohmann::basic_json<std::map, std::vector, std::pmr::string, bool, std::int64_t, std::uint64_t, double, std::pmr::polymorphic_allocator>;
auto s = load_file("citm_catalog.json");
for (auto _ : state) {
auto jv = pmr_json::parse(s.begin(), s.end());
}
}
BENCHMARK(nlohmann_JSON_PMR);

static void Boost_JSON_PMR_Monotonic_Parse(benchmark::State &state, std::string_view s)
{
Expand Down
4 changes: 2 additions & 2 deletions PMR/performance_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -558,11 +558,11 @@ static void CreateAndAccess(benchmark::State &state)
auto worker = []() {
Allocator alloc;
std::pmr::list<int> values(alloc.get_resource());
for (int i = 0; i < 1000; ++i) {
for (int i = 0; i < 100000; ++i) {
values.push_back(i);
}

for (int i = 0; i < 10000; ++i) {
for (int i = 0; i < 1000; ++i) {
for (auto &value : values) {
++value;
}
Expand Down

0 comments on commit 099a670

Please sign in to comment.