Skip to content

Repository files navigation

bench_json4cpp

在确保 cmake/makefile/gcc or clang or msvc 都准备好的情况下,clone 项目后使用下面的命令进行一键 benchmar

cmake -DCMAKE_BUILD_TYPE=Release -B build && cmake --build build && ./build/benchmark/json_bench

M3Pro 的测试结果如下:

ns/opop/serr%totalbenchmark
547,240.601,827.353.3%0.65Parse:nlohmann
537,145.301,861.690.8%0.64Parse:jsoncpp
134,859.057,415.150.9%0.16Parse:rapid_json
49,526.3920,191.252.6%0.06Parse:sonic_json
116,495.418,584.030.3%0.14Parse:ejson
206,079.694,852.490.6%0.25Stringify:nlohmann
320,726.383,117.920.2%0.38Stringify:jsoncpp
131,007.987,633.120.5%0.15Stringify:rapid_json
11,907.3783,981.610.3%0.01Stringify:sonic_json
76,992.0712,988.350.9%0.09Stringify:ejson
67.9514,715,735.070.5%0.00FindMember:nlohmann
57.3517,436,791.631.2%0.00FindMember:jsoncpp
254.653,926,892.951.8%0.00FindMember:rapid_json
242.824,118,239.222.0%0.00FindMember:sonic_json
10.7493,138,367.920.1%0.00FindMember:ejson

自 2025-01-02 加入了字节开源的 Sonic-Cpp 作为对比,发现其性能形成了成倍碾压。。。 但 ejson4cpp 在简洁好用的同时确实达到了和 rapid-json 在同一个性能水平

About

简单测试C++的json解析库性能

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages