casei: close the Rebar Unicode gaps - #12
Merged
Merged
Conversation
The original arena omitted multi-pattern enumeration and the hard Unicode shapes that exposed decoded confirmation cost. Rebar found three same-contract losses, including a roughly ninefold gap. Add tagged multi-pattern candidates, width-aware raw confirmation, an exact common-byte origin gate, and wider AVX-512 schedules. Pair each field timing with its competitor and retain the two-host field, Rebar, ablation, and native-reachability receipts. The resulting source wins every current arena row and all five same-contract Rebar rows on Ice Lake and Sapphire Rapids while preserving the simple-fold contract and portable fallback.
The library supports Go 1.22, while testing.B.Loop was added in Go 1.24. Keep the diagnostic benchmark and its B.Loop timing semantics without making the ordinary amd64 test file require a newer toolchain.
Go vet checks assembly stack operands against the declaration names. Name the two multi-value results so the existing ret, width, and tags operands match the Go ABI without changing the generated instruction stream.
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.
The original arena covered first-match search and single-needle counting. Rebar then exposed the missing question: enumerate non-overlapping Unicode-simple-fold matches. casei won two of the five rows with the same contract and lost three, with the worst row roughly nine times slower.
This change closes that gap while preserving the existing contract and one-engine design.
Before and after
The three added mechanisms each have a measured consumer. Removing variable confirmation loses two of five same-contract Rebar rows on both hosts. Ignoring returned tags loses one on Ice Lake. Removing the common-byte origin gate loses the focused N=5 arena rows on both hosts.
The amd64 work also widens the exact-byte and tagged VBMI schedules so independent cache lines remain in flight before ordered mask tests. OpcodeX supports the Ice Lake scheduling explanation. Sapphire Rapids is supported by emitted disassembly, direct execution, and full-field measurements because the current OpcodeX catalog has no Sapphire Rapids column.
Result
x_vs_best=0.9614, worst sample0.9622.0.9693, worst sample0.9716.0.8766on Ice Lake and0.8919on Sapphire Rapids.Evidence
The checked-in record contains:
Local gates pass:
go test, race, vet, staticcheck, golangci-lint, gofmt, cross-builds, baseline isolation, receipt verification, andgit diff --check.The persistent Bentley/Thompson panel is green after one accepted evidence finding. The repair scoped the historical 36-entry GDB claim to its old commit and added current two-host reachability receipts. Distill removed mechanisms without measured consumers; the thermo review removed four dead helpers/accessors.
Scope
The speed claim covers x86-64 AVX-512F/BW/VBMI on Ice Lake and Sapphire Rapids. The portable and ARM64 paths remain correct and scalar. Full-fold expansion and general regex syntax remain outside the API.
The pushed commit is
f109e85. Its tree is76d988f95380e236a78dc9fe76207302bb72aca3, identical to the clean tree already exercised on both VMs. The PR remains draft while the extra immutable-tree hardware rerun is completed.