feat(json): add high-performance C++20 DOM parser - #386
Draft
qicosmos wants to merge 1 commit into
Draft
Conversation
qicosmos
commented
Aug 12, 2026
qicosmos
left a comment
Owner
Author
There was a problem hiding this comment.
主要问题:
-
编译错误风险:
benchmark/json_benchmark.cpp约 275 行起多处使用ScopedTimer timer(name.data(), ns);,但 diff 中ScopedTimer构造函数仍显示只接受const char*。若未新增重载会直接编译失败。 -
CMake 顺序/目标风险:
CMakeLists.txt约 136 行对json_benchmark调用set_target_properties/target_compile_options,需确认该 target 一定已创建,否则配置失败。 -
AVX2 选项安全性:约 145 行仅按
CMAKE_SYSTEM_PROCESSOR判断,不代表运行机器支持 AVX2。开启后生成二进制在非 AVX2 CPU 上会非法指令,建议文档明确或做运行时分发。 -
benchmark 公平性:DOM parse 每轮构造/销毁
document,而 reuse 版本复用容量;结果需明确区分,否则容易误导。 -
代码风格:
volatile size_t json_parse_sink用于防优化可以接受,但json_parse_sink = json_parse_sink + value不必要,建议用更标准的 benchmark 防优化方式。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Why
Iguana needed a reusable DOM parsing path for workloads that require dynamic JSON access while retaining competitive throughput and avoiding per-parse allocations where possible.
Performance
On the controlled fixed-core corpus run, Iguana reached 2.271 GiB/s versus simdjson at 2.466 GiB/s, a 7.81% gap. The retained continuation-path optimization improved array strings by 15.54%, object strings by 8.39%, and array numbers by 20.77%.
Validation
git diff --check