GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Eliminate redundant bounds checks in CompositeByteBuf accessors by franz1981 · Pull Request #16801 · netty/netty

Conversation

@franz1981

@franz1981 franz1981 commented May 12, 2026

Copy link
Copy Markdown
Contributor

Motivation:

Every _getXxx/_setXxx in CompositeByteBuf delegates to the underlying
buffer's public API (e.g. c.buf.getByte()), which re-checks bounds that
the composite level already validated.

Modifications:

  • Add an abuf field to Component that caches (AbstractByteBuf) buf
    at construction time, or null for non-AbstractByteBuf wrappers
  • Use abuf._getXxx() (no bounds check) when available, fall back to
    buf.getXxx() otherwise
  • Add sequentialReadBytes and sequentialGetBytes JMH benchmarks
  • Add test for discardReadComponents not corrupting subsequent reads

Result:

Redundant bounds checks eliminated on the hot path.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@franz1981

franz1981 commented May 12, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

Blocked by #16800

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@franz1981
franz1981 marked this pull request as ready for review May 12, 2026 14:31
franz1981 added 2 commits May 12, 2026 16:31
@franz1981
Revert "Fix component search fast path (netty#16548)"
1089178
This reverts commit 59aec4b.
@franz1981
Eliminate redundant bounds checks in CompositeByteBuf accessors
ff008bb
Motivation:

Every _getXxx/_setXxx in CompositeByteBuf delegates to the underlying
buffer's public API (e.g. c.buf.getByte()), which re-checks bounds that
the composite level already validated.

Modifications:

- Add an `abuf` field to Component that caches `(AbstractByteBuf) buf`
at construction time, or null for non-AbstractByteBuf wrappers
- Use abuf._getXxx() (no bounds check) when available, fall back to
buf.getXxx() otherwise
- Add sequentialReadBytes and sequentialGetBytes JMH benchmarks
- Add test for discardReadComponents not corrupting subsequent reads

Result:

Redundant bounds checks eliminated on the hot path.
@franz1981
franz1981 force-pushed the 4.2_composite_bound_check_elim branch from 979ebad to ff008bb Compare May 12, 2026 14:31
@franz1981 franz1981 mentioned this pull request May 12, 2026
CompositeByteBuf component fast search still not working in all scenarios #16799
Closed
@chrisvest chrisvest mentioned this pull request May 13, 2026
Revert "Fix component search fast path (#16548)" #16800
Closed
@franz1981

franz1981 commented Jun 4, 2026

Copy link
Copy Markdown
Contributor Author

WDYT About this too @chrisvest it should be low risk

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@franz1981
Merge branch '4.2' into 4.2_composite_bound_check_elim
60d872e
@franz1981

franz1981 commented Jun 6, 2026

Copy link
Copy Markdown
Contributor Author

Since #16811 has been merged , this is safe enough to merge wdyt @chrisvest and @normanmaurer ?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@franz1981
franz1981 requested review from chrisvest and yawkat June 6, 2026 16:06
@franz1981
franz1981 marked this pull request as draft June 6, 2026 16:06
@franz1981

franz1981 commented Jun 6, 2026

Copy link
Copy Markdown
Contributor Author

Oh no, my trying to resolve the conflict on github i've removed the right changes ahaha -> putting it in draft!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@normanmaurer

normanmaurer commented Jun 24, 2026

Copy link
Copy Markdown
Member

@franz1981 let me know once this is ready again

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@normanmaurer
Merge branch '4.2' into 4.2_composite_bound_check_elim
68f6bf2
@testlens-app

testlens-app Bot commented Oct 20, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

🚨 Jobs failed without executing tests 🚨

Failed Jobs without Test Failures

❌ Build PR / verify-pr
❌ CodeQL / Analyze (cpp)
❌ CodeQL / Analyze (java)
❌ Verify native library loading on musl / build-jars-aarch64
❌ Verify native library loading on musl / build-jars-x86_64

🏷️ Commit: 68f6bf2
▶️ Tests: 0 executed
⚪️ Checks: 11/11 completed

Rerun Controls

Click the checkbox to trigger a rerun:

  • Rerun jobs

Learn more about TestLens at testlens.app/docs.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

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

Reviewers

@yawkat yawkat Awaiting requested review from yawkat
@chrisvest chrisvest Awaiting requested review from chrisvest

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@franz1981 @normanmaurer
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.