Skip to content

Add AsciiSequence, a CharSequence view of ASCII bytes - #13617

Draft
dougqh wants to merge 1 commit into
dougqh/charsequence-parsersfrom
dougqh/ascii-view
Draft

dougqh wants to merge 1 commit into
dougqh/charsequence-parsersfrom
dougqh/ascii-view

Conversation

@dougqh

@dougqh dougqh commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

What Does This Do

Adds AsciiSequence (internal-api, next to SubSequence): a CharSequence view of a range of a byte[] 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, so charAt is a load.
  • @NoEscape, like SubSequence: 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 with toString(), which is one ISO-8859-1 decode, a single copy for ASCII bytes.
  • Deliberately minimal: the CharSequence methods and toString(). Equality is identity (no content equality or hashing, unlike SubSequence), since nothing needs them yet.
  • AsciiSequenceTest: views at an offset, non-ASCII bytes refused, toString copying, parsing in place with LongStringUtils.parseUnsignedLong, and bounds checks.

🤖 Generated with Claude Code

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>
@dougqh dougqh added comp: core Tracer core tag: performance Performance related changes tag: no release notes Changes to exclude from release notes type: refactoring tag: ai generated Largely based on code generated by an AI or LLM labels Nov 21, 2026
@datadog-official

datadog-official Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

🎯 Code Coverage (details)
• Patch Coverage: 100.00%
• Overall Coverage: 59.39% (+0.02%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: c4d9997 | Docs | Give us feedback!

@dd-octo-sts

dd-octo-sts Bot commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

🟢 Java Benchmark SLOs — All performance SLOs passed

Suite Status
Startup 🟢 pass

SLO thresholds are defined here based on automatically generated metrics. A warning is raised when results are within 5% of the threshold.

PR vs. master results
Scenario Candidate master Δ (95% CI of mean)
startup:insecure-bank:iast:Agent 14.84 s 14.68 s [+0.3%; +1.9%] (maybe worse)
startup:insecure-bank:tracing:Agent 13.69 s 13.73 s [-1.1%; +0.6%] (no difference)
startup:petclinic:appsec:Agent 17.21 s 17.04 s [+0.4%; +1.7%] (maybe worse)
startup:petclinic:iast:Agent 16.44 s 17.02 s [-7.6%; +0.8%] (no difference)
startup:petclinic:profiling:Agent 16.70 s 16.83 s [-1.8%; +0.3%] (no difference)
startup:petclinic:sca:Agent 17.09 s 17.05 s [-0.6%; +1.0%] (no difference)
startup:petclinic:tracing:Agent 16.23 s 16.19 s [-0.7%; +1.2%] (no difference)

Commit: c4d99977 · CI Pipeline · Benchmarking Platform UI


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

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: core Tracer core tag: ai generated Largely based on code generated by an AI or LLM tag: no release notes Changes to exclude from release notes tag: performance Performance related changes type: refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant