decoder: Try new and faster approach to check if string needs to be r… - #75
Conversation
|
Warning Review limit reached
Next review available in: 49 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe Ubuntu CI job now builds PHP and the extension directly, then runs tests in parallel. The decoder now handles custom memory managers explicitly and calculates standard allocator padding from Zend MM chunk boundaries. ChangesUbuntu CI build
SIMDJSON allocation handling
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR updates the decoder’s logic for deciding whether an input zend_string must be copied into a simdjson::padded_string by replacing an allocation-size-based check with a chunk-boundary-based check, aiming to reduce overhead in the fast path.
Changes:
- Reworks
simdjson_realloc_needed()to infer padding safety from Zend MM chunk boundaries instead of callingzend_mem_block_size(). - Renames the helper’s parameter from
jsontostrfor clarity.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
2569eab to
316ce25
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/integration.yml:
- Line 48: Update the tar invocation in the integration workflow to place the
stdin archive operand correctly while retaining extraction, xz decompression,
and --strip-components=1; ensure the piped curl stream is explicitly supplied as
tar’s archive file input rather than being misinterpreted as an option value.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: b926dde7-511b-4eba-b8f1-40affe001493
📒 Files selected for processing (2)
.github/workflows/integration.ymlsrc/simdjson_decoder.cpp
316ce25 to
f8454be
Compare
f8454be to
4b5ec02
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
Suppressed comments (1)
src/simdjson_decoder.cpp:166
- The new padding check computes remaining space based on the end of the current Zend MM chunk, not the actual allocation size of the zend_string. This can return "no realloc needed" even when the string’s allocation doesn’t include SIMDJSON_PADDING bytes, which risks out-of-bounds reads when creating a padded_string_view.
// Get start position of chunk that stores zend_string
size_t chunk_start = struct_addr & ~(ZEND_MM_CHUNK_SIZE - 1);
size_t string_end = struct_addr + struct_size;
// Check if chunk has still space for padding after string end
return string_end + simdjson::SIMDJSON_PADDING > chunk_start + (struct_size / ZEND_MM_CHUNK_SIZE + 1) * ZEND_MM_CHUNK_SIZE;
4b5ec02 to
ed88190
Compare
…eallocated
Summary by CodeRabbit
Bug Fixes
Tests