8000 perf: pre-build MutexStorageBackend in CommittedFactLoaderImpl to eliminate per-resolve() Arc::clone (#280) by adityamukho · Pull Request #281 · project-minigraf/minigraf · GitHub
[go: up one dir, main page]

Skip to content

perf: pre-build MutexStorageBackend in CommittedFactLoaderImpl to eliminate per-resolve() Arc::clone (#280) - #281

Merged
adityamukho merged 2 commits into
mainfrom
fix/280-resolve-arc-clone-regression
May 21, 2026
Merged

adityamukho merged 2 commits into
mainfrom
fix/280-resolve-arc-clone-regression

Conversation

@adityamukho
Copy link
Copy Markdown
Collaborator

Summary

Test plan

  • 962 tests pass (cargo test)
  • cargo clippy clean
  • cargo fmt --check clean
  • All 3 CommittedFactLoaderImpl construction sites updated

Closes #280

🤖 Generated with Claude Code

adityamukho and others added 2 commits May 21, 2026 08:11
…280 regression

#279 fixed concurrent mutex serialization by switching resolve() to use
MutexStorageBackend instead of locking backend directly before get_or_load().
This kept #279's correctness (mutex only acquired on cache misses) but
introduced an Arc::clone + Arc::drop on every resolve() call.

At 10k facts, point_attribute queries call resolve() ~10k times per
iteration, making the per-call overhead measurable: +22% on
query/point_attribute/10k (29.4 ms vs 24.1 ms pre-regression), with
cascading slowdowns of 8-17% on other large-dataset query benchmarks.

Fix: construct MutexStorageBackend once at CommittedFactLoaderImpl
creation time and store it as a field. resolve() now uses
&self.backend_adapter directly — zero per-call allocation or atomic ops.
The concurrency property is fully preserved: backend mutex is still only
acquired inside MutexStorageBackend::read_page() on a cache miss.

Closes #280

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@codecov
codecov Bot commented May 21, 2026
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/storage/persistent_facts.rs 83.33% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@adityamukho
adityamukho merged commit 5fca2eb into main May 21, 2026
15 checks passed
@adityamukho
adityamukho deleted the fix/280-resolve-arc-clone-regression branch May 21, 2026 02:51
adityamukho added a commit that referenced this pull request May 21, 2026
- BENCHMARKS.md: replace stale v0.8.0 query latency entries for
  point_attribute and join_3pattern with v1.1.1 Bencher CI baseline
  (ubuntu-latest); add predicate_pushdown section; update regex_filter
  estimates to actual CI numbers; fix stale prose claiming selective
  B+tree lookup is a post-1.0 backlog item (shipped in #208); add
  Post-1.0 Updates header documenting #208/#279/#281 impact on numbers
- README.md: fix stale "(Phase 7 target: predicate pushdown)" note —
  predicate pushdown shipped in #207

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Benchmark regression - 2026-05-20

1 participant

0