[WIP] ByteString Two-Way string matching in indexOfSlice#2324
Draft
pjfanning wants to merge 8 commits intoapache:mainfrom
Draft
[WIP] ByteString Two-Way string matching in indexOfSlice#2324pjfanning wants to merge 8 commits intoapache:mainfrom
pjfanning wants to merge 8 commits intoapache:mainfrom
Conversation
Member
pjfanning
commented
Oct 18, 2025
- See [WIP] use getLong when matching byte sequences in ByteString #2323 and Revisit indexOfSlice performance improvements #2321
- the aim is to benchmark both solutions - this one is more complicated so it would need to be much better to justify being used
69114aa to
f90969d
Compare
… array segments match format fix issue more fully copy Netty Two-Way string matching impl scalafmt format Update SWARUtil.scala Update ByteString.scala
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a Netty-derived two-way string matching algorithm for ByteString.indexOfSlice (and a shared byte-segment matcher), aiming to evaluate potential performance improvements versus existing implementations.
Changes:
- Add Netty-derived two-way substring search implementation to
ByteString1/ByteString1CindexOfSlice. - Introduce optimized byte-segment matching helpers (
bytesMatch/arrayBytesMatch) usinggetLongcomparisons. - Update licensing files to reflect Netty-derived code usage in
ByteString.scala.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| LICENSE | Adds ByteString.scala to the list of Netty-derived sources. |
| legal/pekko-actor-jar-license.txt | Mirrors the LICENSE update for the actor JAR legal file. |
| actor/src/main/scala/org/apache/pekko/util/SWARUtil.scala | Makes SWAR helpers final and adds Netty-derived helpers (arrayBytesMatch, maxSuf). |
| actor/src/main/scala/org/apache/pekko/util/ByteString.scala | Adds Netty-derived two-way matching for indexOfSlice and introduces bytesMatch abstraction/optimizations. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.