Skip to content

try to improve perf on ByteStrings.apply - #3429

Open
pjfanning wants to merge 1 commit into
apache:mainfrom
pjfanning:bytestring-apply
Open

try to improve perf on ByteStrings.apply#3429
pjfanning wants to merge 1 commit into
apache:mainfrom
pjfanning:bytestring-apply

Conversation

@pjfanning

Copy link
Copy Markdown
Member

The change adds a pre-computed fragmentStartOffsets array (one Int per fragment, built once in the constructor) and uses java.util.Arrays.binarySearch in apply(idx) to locate the fragment in O(log n) instead of the previous O(n) linear scan. The extra memory is one Int per fragment (typically 3-10 fragments).

@He-Pin He-Pin added this to the 2.0.0-M4 milestone Aug 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants