Repository navigation
perf(engine): keep every query's stream in the allocator's thread cache (#721 follow-up) - #726
Merged
Merged
Conversation
…allocator's thread cache (#721) #721 put Probes (176 bytes) inline in IdSpace, growing the boxed Stream of every query from 880 to 1,056 bytes, past glibc's 1,032-byte tcache limit: each query's stream went through the locked bins, about 1 us (5%) on a point query. Probes is now made on first use. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0169pNQsLcCEn48te9X9WuZW
…ord (#721) #721 wrapped every committed scan's shadow set in an Arc, one more allocation per scan even when no pending record decides a triple. It is now None when empty: a point query allocates what it did before #721 (261 allocations, 18,835 bytes at 100K facts). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0169pNQsLcCEn48te9X9WuZW
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0169pNQsLcCEn48te9X9WuZW
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0169pNQsLcCEn48te9X9WuZW
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
Found while measuring #551 PR 3. After #722 (#721), every small query took about 1 µs (5%) longer:
point_entity17.0 → 18.0 µs,attribute_value+4.8%, at every scale. Three-way alternation on one NUMA node (base 1096e6a, v3 just before #721 at ef6bc58, v3 now) shows v3 just before #721 level with base, so #721 alone causes it.Cause
Probes(176 bytes) inline inIdSpace. This grew every query'sBox<Stream>from 880 to 1,056 bytes, past glibc's 1,032-byte tcache limit, so each query's stream went through_int_malloc/_int_free.perfputs the extra time in glibc's malloc internals.Arc::new, adding one allocation per scan.Fix
IdSpace::probesisOption<Box<Probes>>, made by the first value probe (probes_mut); reads go throughprobes().releasedrops it.Committed::shadowisNonewhen no pending record decides a triple.stream_fits_the_allocator_thread_cache(Linux glibc, 64-bit):size_of::<Stream>() <= 1032. The stream is now 888 bytes in release.Measured (bench machine, 100K fixture,
[:find ?a :where [:p8333 :age ?a]]× 200,000, 4 alternating rounds):The remaining ~3% is code layout from #721's scan rework (
pending_live,consts,pending_records,push_factsare no longer inlined). That's under the 5% investigation threshold, so it's left as is.Tests: bench machine,
cargo test1,702 passed / 12 ignored,--features test-hooks1,718 / 13, no failures. Codex review: no correctness findings; its one note (the size test assumes glibc) is addressed by gating ontarget_env = "gnu".Docs: CHANGELOG #721 entry, CLAUDE.md and TEST_COVERAGE counts. No docs-site change (internal).
🤖 Generated with Claude Code
https://claude.ai/code/session_0169pNQsLcCEn48te9X9WuZW