Avoid ArrayList<Integer> boxing when collecting ParNew promotion-failure sizes - #2
Draft
java-dependency-upgrade-fixer[bot] wants to merge 1 commit into
Conversation
Owner
|
Campaign acceptance microsoft#5 (independently reviewed)
Accepted as a genuine, reviewable internal allocation improvement; remains draft and unmerged. |
This was referenced Aug 23, 2026
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
GenerationalHeapParser.parNewPromotionFailedDetails collected per-thread promotion-failure sizes into an ArrayList (one autoboxed Integer allocation per matched '(N: promotion failure size = X)' block, plus ArrayList's own internal Object[] growth) and then copied/unboxed every element into a final int[]. This companion replaces the ArrayList with a growable primitive int[] (capacity doubling from 4) that is trimmed once via Arrays.copyOf, matching the exact same values, order, and empty-array behavior when the regex finds no promotion-failure-size block (the null-guard already present in the PR head is preserved).
Why
The PR mirrors microsoft#579 and, per the evaluation context, one changed parser path still gathered primitive promotion-failure sizes through ArrayList before allocating/copying an int[]. This is exactly that path (parNewPromotionFailedDetails, lines changed by the same PR to add the block == null guard). No other changed line in this PR (CMSPatterns.java's cached SPLIT_REMARK_REFERENCE_BUG_DURATION regex, or the other null-guard additions in GenerationalHeapParser.java) presented a similarly safe, material allocation/parsing-work reduction, so those were left unchanged.
Behavior preservation
Evidence
Limitations
Generated by JAIPilot Cloud for #1 from Anthropic session
sesn_01UZHhdPrsSrQEbHSEmJDv9c.