On Wed, 2 Apr 2025 11:42:03 GMT, Maurizio Cimadamore <mcimadam...@openjdk.org> 
wrote:

>> src/java.base/share/classes/java/lang/StableValue.java line 209:
>> 
>>> 207:  *     private SqrtUtil(){}
>>> 208:  *
>>> 209:  *     private static final Set<Integer> CACHED_KEYS = Set.of(1, 2, 4, 
>>> 8, 16, 32);
>> 
>> This is not the same as before, is it? E.g. in the previous example, we had 
>> cached results for `0 <= input < CACHED_SIZE`. But here we hand-pick some 
>> values for which we know the square root is also an int. I think the two 
>> example should be the same, so as to attract attention on how stable int 
>> function vs. stable function works...
>
> The same discrepancy is present in the list vs. map examples

There are two fundamental variants. One with `CACHED_SIZE` (for list and int 
function) and one with `CACHED_KEYS` (for map and function).

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/23972#discussion_r2024679612

Reply via email to