cpp_weekly
cpp_weekly copied to clipboard
Homework: make PMR permeate the nlohmann JSON parser
From: https://youtu.be/R5PHRY5Pnlg?si=eSqaT0wj4_bGwHNi&t=949
- I used a stateless allocator method and left the nlohmann JSON library unmodified.
- This allows the
std::pmr::memory_resourceinstance to permeate the nlohmann JSON parser, andstd::pmr::polymorphic_allocatoris not involved. - There are some improvements in parsing speed over the default parse.
Benchmark Time CPU Iterations UserCounters...
----------------------------------------------------------------------------------------------------------------------------------
JSON_Perf/nlohmann_JSON_Default-"citm_catalog.json" 17851651 ns 17780746 ns 36 bytes_per_second=92.639Mi/s
JSON_Perf/nlohmann_JSON_MBR_stateless_alloc-"citm_catalog.json" 14170186 ns 14104444 ns 47 bytes_per_second=116.785Mi/s
JSON_Perf/nlohmann_JSON_MBR_stateless_alloc_devirt-"citm_catalog.json" 11097326 ns 11069338 ns 59 bytes_per_second=148.807Mi/s
JSON_Perf/nlohmann_JSON_Default-"gsoc-2018.json" 39429436 ns 39326477 ns 21 bytes_per_second=80.7005Mi/s
JSON_Perf/nlohmann_JSON_MBR_stateless_alloc-"gsoc-2018.json" 37385009 ns 37279595 ns 22 bytes_per_second=85.1315Mi/s
JSON_Perf/nlohmann_JSON_MBR_stateless_alloc_devirt-"gsoc-2018.json" 39008590 ns 38931608 ns 18 bytes_per_second=81.519Mi/s
JSON_Perf/nlohmann_JSON_Default-"github_events.json" 1073415 ns 1071191 ns 607 bytes_per_second=57.9866Mi/s
JSON_Perf/nlohmann_JSON_MBR_stateless_alloc-"github_events.json" 752468 ns 750393 ns 1019 bytes_per_second=82.7762Mi/s
JSON_Perf/nlohmann_JSON_MBR_stateless_alloc_devirt-"github_events.json" 724156 ns 722657 ns 954 bytes_per_second=85.9532Mi/s```