Repository navigation
perf: reduce byte-word shingle allocation and copying - #1059
Merged
Merged
Conversation
…nto perf/borrow-normalized-shingles
…nto perf/borrow-normalized-shingles
This was referenced Nov 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Word-similarity comparisons now avoid redundant word-window strings and repeated work for byte-identical content while preserving the existing exact scores. The selected implementation improves larger native similarity workloads on both macOS and Linux; rejected alternatives and slower controls remain documented.
AG;DR
Implementation and scope
Evidence and tradeoffs
docs/benchmarks/byte-shingle-representations-20261102.mdand its 2.75 MB compressed lossless artifact retain exact sources, compiler/link commands, samples, oracles, setup failures and rejected prototypes. The original all-view one-word path regressed larger macOS kernels by 26-33%; direct word-to-set insertion was also not selected. The final staged path is separately measured.Per platform: 66 native cases x 3 sessions, 51 whole-engine/kernel cases x 3 sessions x 2 variants, plus ten native cases x 5 confirmation sessions and eight memory cases x 3 confirmation sessions with an identical-baseline participant. Each uses a discarded warmup and rotating nine-round/fastest-seven measurements. Linux tmpfs/affinity and macOS warm APFS remain separate contracts. Complete native output is checked against an independent oracle; timings never overlap builds, lint, sanitizers or allocation diagnostics on the host.
Confirmed 10,000-file nearby/strict word cases reduce native elapsed time by about 18-26% on macOS and 46-49% on Linux. Disjoint one-word confirmation is about 4.5% faster on macOS and 27.5% on Linux. Exact-content gains are separate. Preserve listing controls: initial Linux listing was +8.21%, confirmation +2.36% versus an identical-baseline repeat of +0.95%; small near controls also show about +1.2%. These are not hidden or normalized away. Requested workers do not imply newly parallel similarity evaluation.
ASan allocation-hook counts are diagnostics only; no instrumented times are performance evidence. Wider nearby shingles cut thousands of allocation requests to roughly 130; macOS one-word allocation count increases slightly while requested bytes and release elapsed time decrease. Unstripped CLI size changes: Linux +8,664 bytes; macOS +176 bytes. Binary linkage remains system-only with no additional libraries.
Validation and dependency
Merge sequencing: explicitly held by the user while #1065 is attempted first. Auto-merge is disabled; do not merge this PR automatically.