Skip to content

perf(core): avoid packed identity allocations - #52

Merged
seonghobae merged 1 commit into
docs/product-technical-gap-baselinefrom
codex/packed-authorization-perf
Aug 31, 2026
Merged

perf(core): avoid packed identity allocations#52
seonghobae merged 1 commit into
docs/product-technical-gap-baselinefrom
codex/packed-authorization-perf

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Summary

  • retain packed authorization identities as borrowed UTF-8 slices
  • use nested exact lookup maps so packed requests do not allocate one Rust string pair per candidate
  • preserve deterministic exact scores and input/output digests

This is stacked on the exact-index prerequisite merged into #41 by #51. It remains insufficient by itself for the LineageWeave 20 ms concurrent full-path contract.

Validation

  • RankWeave Rust: 21 passed, 100% line/function/region coverage
  • workspace clippy with warnings denied
  • Python: 688 passed
  • real macOS abi3 wheel and sdist verified
  • full Lineage phase benchmark: exact owner rank 4.964-6.896 ms for 6,578 x 3,072; four concurrent full requests still exceed 20 ms

Signed-off-by: Seongho Bae seongho.bae@gmail.com


Devin Review

Signed-off-by: Seongho Bae <me@seonghobae.me>
@coderabbitai

coderabbitai Bot commented Aug 31, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 05aed99c-bbe6-438c-be1e-2e0914121d80

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@seonghobae
seonghobae merged commit 03354a4 into docs/product-technical-gap-baseline Aug 31, 2026
7 of 8 checks passed
@seonghobae
seonghobae deleted the codex/packed-authorization-perf branch August 31, 2026 10:50

@devin-ai-integration devin-ai-integration Bot 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.

Devin Review found 3 potential issues.

Devin Review

Comment on lines 486 to +489
let end = *cursor + length;
let value = &bytes[*cursor..end];
*cursor = end;
String::from_utf8(value.to_vec()).map_err(|_| SemanticIndexError::NonUtf8PackedAuthorization)
std::str::from_utf8(value).map_err(|_| SemanticIndexError::NonUtf8PackedAuthorization)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📝 Info: Borrowed identity lifetime is bounded

read_packed_text borrows from the immutable request buffer. Ranking finishes before that buffer is released, including lookups, duplicate checks, and digesting.

(Refers to this code)

Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Comment on lines +201 to +204
candidate_lookup
.entry(item_id.clone())
.or_default()
.insert(unit_id.clone(), index);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📝 Info: Nested lookup preserves identity semantics

Every lookup still requires both item and unit identifiers. Separate pair detection rejects duplicates, while explicit result sorting prevents map order from changing output.

Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

return Err(SemanticIndexError::MalformedPackedAuthorization);
}
self.rank_authorized(model_identity, query_vector, &authorized)
self.rank_authorized_refs(model_identity, query_vector, &authorized)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📝 Info: Both transports retain digest parity

Both entry points converge on rank_authorized_refs, which hashes identical UTF-8 bytes in caller order. Ownership no longer affects validation or output evidence.

Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

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