ci: add agent guide and benchmark comparison (#137)
Summary
- Add a repository-level
AGENTS.mdguide for coding agents and contributors.- Add benchmark comparison CI that runs base/head Google Benchmark jobs, compares JSON outputs, and posts a sticky PR comment.
- Add
scripts/tools/compare-benchmark.pyto generate Markdown benchmark summaries and fail on regressions above the configured threshold.Notes
- This PR changes no library runtime code.
- The benchmark workflow is intended for follow-up OOM split PRs; once this lands on
master, later PRs can consume it directly.Validation
python3 -m py_compile scripts/tools/compare-benchmark.py- `python3 scripts/tools/compare-benchmark.py /tmp/sonic_master_bench.json /tmp/sonic_master_bench.json
- -warn-threshold=3 –fail-threshold=5
- -output=/tmp/sonic_benchmark_comment_test.md`
git diff --cached --checkbefore commit
版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9
京公网安备 11010802047560号
Sonic-Cpp
A fast JSON serializing & deserializing library, accelerated by SIMD.
Requirement
Features
Benchmarks
use CMake
use bazel
Performance by sonic benchmark
Parsing Performance
Serializing performance
Performance by third-party benchmark
Below data is test by https://github.com/miloyip/nativejson-benchmark:
Parsing Performance
Serializing Performance
API Document
Make sure Doxygen 1.8.13 or higher version has been installed. Then following:
Design
Sonic-cpp parses JSON into a compact document tree. The document structure is as follows:
There are many optimizations in parsing as follows:
Sonic-cpp serializes a document to JSON. When serializing JSON strings, we should check the escaped characters first. So, we use SIMD instructions(AVX2/SSE) to find the escaped char for a long JSON string.
Sonic-cpp also supports ParseOnDemand if the user knows the target key at compile time. ParseOndemand also used SIMD and bit manipulation to skip the unwanted values fastly.
Usage
Include
Sonic-Cpp is a header-only library, you only need to include the directory of Sonic-Cpp header files, such as adding
-I/path/to/sonic/include/to your compiler.Parsing and Serializing
Checking parse result
Getting and Setting
The following Is*, Get* and Set* methods are supported:
More usage.
RoadMap
RawNumberfor JSON parsing.JSON Path.JSON Merge Patch.JSON Pointer.Contributing
Please read CONTRIBUTING.md for information on contributing to sonic-cpp.