Skip to content

perf: parallel finite validation and scratch-based rank encode#279

Open
Nelson Spence (Fieldnote-Echo) wants to merge 1 commit into
mainfrom
perf/encode-path
Open

perf: parallel finite validation and scratch-based rank encode#279
Nelson Spence (Fieldnote-Echo) wants to merge 1 commit into
mainfrom
perf/encode-path

Conversation

@Fieldnote-Echo

Copy link
Copy Markdown
Member

Summary

  • assert_all_finite paid a full serial pass per add/search batch — measured 0.097s per GiB. Inputs ≥1M floats now split the sweep across the rayon pool (0.097s → 0.022s measured on a real-corpus GiB slice); the panic message is unchanged.
  • RankQuant::add's parallel closure allocated a fresh ranks Vec per row; for_each_init now reuses per-worker scratch via rank_transform_into.

Measured (262,144 × 1024 real-corpus slice, best-of-3)

Path before after
RankQuant::add 0.302s 0.268s
SignBitmap::add 0.090s 0.062s
OrdinalIndex::add_2d (downstream) 0.489s 0.416s

Companion to ordinaldb perf/parallel-input-validation (same fix at the caller layer, preserving exact first-offender panics). Independent of #277/#278 — branches off main, touches only util.rs/quant.rs.

Full gate: 250 tests + no-default-features + clippy -D warnings green.

Part of the 1M-row release train (encode lane).

assert_all_finite paid a full serial pass per add/search batch —
measured ~0.1s per GiB, twice per ingest batch counting the caller
layer. Scans of 1M+ floats now split across the rayon pool (4.4x
measured). RankQuant::add's per-row closure allocated a fresh ranks
Vec per vector inside the parallel loop; for_each_init now reuses a
per-worker scratch via rank_transform_into. Measured on the 1.26M x
1024 corpus slice: encode-path attribution 0.097s serial scan ->
0.022s parallel; alloc churn removed from the hot loop.
@Fieldnote-Echo

Copy link
Copy Markdown
Member Author

Codex (@codex) review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

1 similar comment
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@codecov

codecov Bot commented Jul 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.61538% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/util.rs 60.00% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@Fieldnote-Echo

Copy link
Copy Markdown
Member Author

/agentic_review

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Qodo Logo

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.

2 participants