8000 perf(query): batch projected UUID lookups (#530) by adityamukho · Pull Request #771 · project-minigraf/minigraf · GitHub
[go: up one dir, main page]

Skip to content

perf(query): batch projected UUID lookups (#530) - #771

Merged
adityamukho merged 2 commits into
v3from
perf/530-dict-batch
Oct 27, 2026
Merged

adityamukho merged 2 commits into
v3from
perf/530-dict-batch

Conversation

@adityamukho
@adityamukho adityamukho commented Oct 27, 2026 •
Copy link
Copy Markdown
Collaborator

Summary

[:find ?e ?a :where [?e :age ?a]] still performed a root-to-leaf DICT lookup for each returned UUID. Projection now collects up to 1,024 distinct committed ids into bounded stack hints. Dense batches reuse the existing leaf cursor; sparse/small batches keep exact scalar reads. Cache insertion, memory charges and errors retain projection order, and lookups use the query's pinned generation.

The paired, NUMA-pinned 1M-fact scan improves from 261.81 to 135.55 ms p50 (48.2% lower) at about 7 MiB peak RSS. Random and descending refs improve 28.2% and 45.5%. The 64-id dense cutoff costs 7.6 µs. Repeated refs varied (+8.2% in the broad rounds, +0.5% in four follow-up pairs); all results remain published. Methods, raw results and reproduction.

Fixes #530

Type of change

  • Bug fix (non-breaking)
  • New feature (non-breaking)
  • Breaking change (requires migration or version bump)
  • Documentation / tests only

Checklist

  • Full default tests under branch coverage plus doctests: 1,896 passed, 15 ignored; full test-hooks: 1,928 passed, 16 ignored (bench)
  • cargo clippy --all-features -- -D warnings and formatting pass
  • All existing coverage gates pass; total lines 95.36%, branches 86.11%; floors unchanged
  • Release binary 1,258,784 bytes, below the unchanged 1,259,520-byte cap (bench)
  • Eleven added tests cover dictionary/read counts, projection/fallback/memory/error order, capacity, and unused entity conversion
  • No unwrap() / expect() in library code paths
  • CHANGELOG.md and synchronized documentation updated under Unreleased
  • Aligns with PHILOSOPHY.md: no dependencies, configuration, public API or file-format changes

Notes for reviewer

The initial generic batch walker exceeded the binary budget and introduced coverage gaps. The final implementation removes that walker and encoder helper, reuses existing tree primitives, and makes no production B+tree/key changes. Scalar conversion remains authoritative after any speculative failure, including corruption encountered in skipped leaves. The dictionary visitor may produce a prefix before an error; projection discards all partial hints.

Claude approved the spec/plan revisions, final code, and final evidence/documentation review. All heavy verification and measurement ran on the bench; timing was sequential and separate from profiling, with 256 KiB probe workers. The final test enhancement received a focused rerun after the broad suites. CI's lint policy excludes test/example targets; an extra all-target lint run reports existing warnings there. Companion docs: project-minigraf/minigraf-docs#77. All 19 final core CI checks pass. Task-owned bench scratch has been removed; detailed logs and review evidence are retained locally. The codebase-wide size audit is tracked in #772 (v3.0.0), attached to production-readiness tracker #383.

@codecov
codecov Bot commented Oct 27, 2026 •
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.21790% with 40 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/query/engine/project.rs 86.06% 38 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!

@adityamukho
adityamukho merged commit c89d648 into v3 Oct 27, 2026
19 checks passed
@adityamukho
adityamukho deleted the perf/530-dict-batch branch October 27, 2026 15:05
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.

1 participant

0