benchmark/accessor_performance/README.md
These benchmarks compare the performance of runtime vs compile-time JSON accessors.
For the comparison to be meaningful, you must build simdjson with support for
C++26 reflexion. See the p2996 repository in the main project directory.
accessor_benchmark.h - Common benchmark framework and test dataruntime_accessors.h - Runtime at_path() benchmarkscompile_time_accessors.h - Compile-time at_path_compiled() benchmarks (requires C++26 reflection)Each benchmark measures parsing + single field access:
.name.address.city.address.coordinates.latcmake -B build -D SIMDJSON_STATIC_REFLECTION=ON -DSIMDJSON_DEVELOPER_MODE=ON
cmake --build build --target=bench_ondemand
The SIMDJSON_STATIC_REFLECTION will be made unnecessary once mainstream compilers
begin supporting C++26 sufficiently well.
# Run all accessor benchmarks
./build/bench_ondemand --benchmark_filter="accessor"
We find that compile-time accessors show performance improvements that scale with path depth:
The speedup comes from eliminating runtime path parsing and conversion overhead.