Skip to content

Accelerate dense unit-edit histogram batches - #7

Closed
mikessh wants to merge 1 commit into
devfrom
feature/unit-histogram-fastpath
Closed

mikessh wants to merge 1 commit into
devfrom
feature/unit-histogram-fastpath

Conversation

@mikessh

@mikessh mikessh commented Oct 10, 2026

Copy link
Copy Markdown
Member

Dense unit-edit count balls spend most of their time walking trie states. Add a word-parallel distance filter with exact capped-edit verification to edit_histogram_batch; retain trie traversal at radii 1–2 and for unsupported scoring geometries. Counts, duplicate handling and exact exclusions are unchanged.

Validation: installed-API oracle tests (26 passed), synthetic capped-edit/UBSan checks, and identical count bins at radii 1–5 with one/four threads. A fresh 32-query/250,000-reference profile reduced radius-5 four-thread counting from 2.9685 s to 0.0715 s with comparable RSS.

Stacked on the histogram API PR #6. No package release is created.

Use a word-parallel Levenshtein filter and verify ambiguous survivors under exact insertion/deletion caps. Retain trie traversal for small radii and unsupported geometries.

Co-Authored-By: Codex <codex@openai.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approved

The optimized path is narrowly guarded and comprehensively checked against existing search results; the remaining feedback concerns only diagnostic clarity.

1 open finding
What changed in this PR

Accelerates dense unit-edit histogram batches while preserving existing trie fallbacks and count semantics.

Changes:

  • Adds word-parallel distance filtering with capped-edit verification.
  • Integrates the fast path into histogram batching.
  • Adds oracle, boundary, fallback, duplicate, and threading tests.
File Description
src/​index.cpp Dispatches eligible histogram queries to the fast path.
src/​count_unit.hpp Implements optimized unit-edit counting.
tests/​python/​test_unit_histogram_fastpath.py Verifies equivalence and fallback behavior.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/count_unit.hpp
if (!length || length>63) throw std::invalid_argument("prototype pattern length must be 1..63");
for (size_t i=0;i<length;++i) {
codes[i]=codec.encode(query[i]);
if (codes[i]==Codec::kInvalid) throw std::invalid_argument("invalid query symbol");
@mikessh
mikessh changed the base branch from feature/edit-histogram-batch to dev October 10, 2026 09:38
@mikessh

mikessh commented Oct 11, 2026

Copy link
Copy Markdown
Member Author

Superseded by the consolidated seqtree 1.1.0 release PR #13; its implementation and validation are retained there.

@mikessh mikessh closed this Oct 11, 2026
@mikessh
mikessh deleted the feature/unit-histogram-fastpath branch October 11, 2026 20:41
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