Repository navigation
Conversation
The byte counterpart of SubSequence: a view of a range of an array whose bytes are all ASCII, without copying or decoding them, so a value that arrived as bytes can be parsed in place. ofAscii returns null if a byte isn't ASCII, and the caller decodes as before. @NoEscape, like SubSequence: a view of a fetched record's bytes shares the whole fetch buffer, so a value that must be kept is copied with toString(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Contributor
🟢 Java Benchmark SLOs — All performance SLOs passed
PR vs. master results
Commit: Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion. |
This branch has not been deployed
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.
What Does This Do
Adds
AsciiSequence(internal-api, next toSubSequence): aCharSequenceview of a range of abyte[]whose bytes are all ASCII, without copying or decoding them. No callers yet.Stacked on #13616.
Motivation
Part 2 of letting propagation parse header values in place (see #13616 for the parts). A Kafka header's value arrives as bytes; today extraction decodes every value into a
String, even the ones it only parses into numbers. A view lets those be parsed straight from the bytes with #13616's range parsers.Additional Notes
ofAscii(bytes, offset, length)returns a view if every byte in the range is ASCII, else null, so the caller decodes those bytes as before. ASCII bytes map to chars one-for-one, socharAtis a load.@NoEscape, likeSubSequence: a view shares its array, and for a fetched record that is the whole fetch buffer. Keeping one in a field, a span, a context or a cache pins all of it, so a value that must be kept is copied withtoString(), which is one ISO-8859-1 decode, a single copy for ASCII bytes.CharSequencemethods andtoString(). Equality is identity (no content equality or hashing, unlikeSubSequence), since nothing needs them yet.AsciiSequenceTest: views at an offset, non-ASCII bytes refused,toStringcopying, parsing in place withLongStringUtils.parseUnsignedLong, and bounds checks.🤖 Generated with Claude Code