8000 perf(query): skip Sort for proven committed input order (#641, 1/3) by adityamukho · Pull Request #778 · project-minigraf/minigraf · GitHub
[go: up one dir, main page]

Skip to content

perf(query): skip Sort for proven committed input order (#641, 1/3) - #778

Merged
adityamukho merged 1 commit into
v3from
feat/641-input-order
Oct 28, 2026
Merged

adityamukho merged 1 commit into
v3from
feat/641-input-order

Conversation

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

Summary

A value-only :order-by query currently scans its whole input through Sort even under a small limit. This resolves conservative order proofs against the query's pinned reader, selects AVET where appropriate, and omits Sort while restoring its projection slots. Entity-and-attribute ranges retain EAVT.

Only a single committed integer, float, or Boolean kind qualifies, including history. Range-local pending/staged records, incomplete tie order, order-changing steps, callbacks and collect-set retain the original plan. Optional proof failures fall back. A zero limit performs no proof reads, including with an offset.

Docs-site companion: project-minigraf/minigraf-docs#80.

Refs #641, slice 1 of 3. Grouped Aggregate and partition Window remain subsequent slices; keep the issue open.

Type of change

  • New feature (non-breaking)

Checklist

  • cargo test passes (bench: default 1,926 passing; test-hooks 1,959)
  • Strict native all-feature and both WASM target clippy checks pass
  • cargo fmt --check passes
  • New unit and public integration tests cover the feature
  • Error paths, callback evaluation, snapshots and working-tree rollback are tested
  • No unwrap() / expect() in library code paths
  • CHANGELOG.md updated under Unreleased
  • Read PHILOSOPHY.md; dependencies, configuration, API and storage format remain stable

Notes for reviewer

Bench evidence: method and tables, with all 504 A/B records and source fingerprints. At the nominal 10M scale, ordered limit falls from 643.947 ms to 0.463 ms; 10M/100K latency is 1.012x, with 12 KiB extra peak RSS. All exact #379 guards remain within 5% (worst +1.39%).

Startup tradeoff: a one-row ordered entity lookup increases from about 21 µs to 117 µs because it still performs eight whole-attribute proof seeks. This is recorded separately from the ordinary point guards.

All unchanged coverage floors pass (95.39% lines / 86.14% branches); 12 Kani harnesses pass; WASI has 1,177 passing tests and a release REPL build; Firefox has 59 passing browser tests including a committed optimized fixture. Chrome is covered by PR CI. The release binary is 1,254,928 bytes under the unchanged 1,259,520-byte cap; shared existing sort comparators remove duplicate generated code. Claude independently reviewed the spec, plan, code and evidence.

@codecov
codecov Bot commented Oct 28, 2026
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.69628% with 22 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/query/engine/order.rs 90.99% 8 Missing and 11 partials ⚠️
src/query/engine/project.rs 0.00% 2 Missing ⚠️
src/graph/storage.rs 95.45% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@adityamukho
adityamukho merged commit b619bdb into v3 Oct 28, 2026
21 checks passed
@adityamukho
adityamukho deleted the feat/641-input-order branch October 28, 2026 12:32
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 361E participant

0