RFR: 8367754: G1: Add a fast path in heap resize related method [v3]
Guanqiang Han
ghan at openjdk.org
Thu Sep 18 13:05:23 UTC 2025
On Thu, 18 Sep 2025 03:32:16 GMT, Guanqiang Han <ghan at openjdk.org> wrote:
>> Please review this change.
>>
>> **Description:**
>>
>> It's common for some Java application engineers to configure the heap with the same minimum and maximum size in order to avoid the overhead of heap resizing.In such cases no expansion or shrinkage is possible, so i think we can adds a fast path at the beginning of the method to detect when the heap’s min and max capacities are equal and return early, thereby avoiding unnecessary computation.
>> I added a check to determine whether MinHeapSize and MaxHeapSize are equal before performing the heap resize calculation. Since both MaxHeapSize and MinHeapSize are aligned to HeapAlignment, so i think comparing them directly is good.
>>
>> **Test:**
>>
>> GHA
>
> Guanqiang Han has updated the pull request incrementally with one additional commit since the last revision:
>
> Update TestHeapResizeAfterGC.java
>
> correct format error
Hi @tschatzl @albertnetymk
Sorry to bother you. Could you kindly take a look at this change? Thanks!
-------------
PR Comment: https://git.openjdk.org/jdk/pull/27349#issuecomment-3307334200
More information about the hotspot-gc-dev
mailing list