Repository navigation
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the path-buffer reuse change.
No open issues 🎉
What changed in this PR
This PR reduces overhead in the JSONPath selector by reusing the path buffer during recursive traversal while preserving JSON Pointer escaping.
Changes:
- Replace per-child path copies with append-and-restore operations.
- Append escaped object-member names directly through a shared helper.
- Add regression coverage for sibling restoration, escaped and empty keys, embedded NULs, and array indices.
| File | Description |
|---|---|
tst/unit/selector_test.cc |
Adds recursive traversal path-restoration and escaping coverage. |
src/json/selector.h |
Updates the escaping helper to accept a path buffer. |
src/json/selector.cc |
Reuses the traversal path buffer and removes stream-based member escaping. |
Review effort: Balanced
|
No actionable comments were generated in the recent review. Walkthrough
Change: Refactor Merge Risk:
|
Signed-off-by: Guy Korland <gkorland@gmail.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
ed0b972 to
a6bd244
Compare
Signed-off-by: Guy Korland <gkorland@gmail.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Recursive JSONPath traversal previously copied the full path and created a stream for each object child. Selector state snapshots also copied the path on every visited container.
Append escaped member names and array indices directly to the existing path buffer, restoring its saved length after traversal. State snapshots now store only the path length. Regression coverage exercises escaped paths, nested filters, recursive updates, and deletes.
Local benchmark: Paired nine-batch
JSON.GETmeasurements on an Apple M2, using matching Release builds and identical results in both versions. Median server time improved in each workload:Timings are local microbenchmarks; actual gains may vary by workload and environment.