On Sun, 24 Nov 2024 08:51:59 GMT, Laurent Bourgès <[email protected]> wrote:
>> @prrace : I added { .. }
>>
>> @bourgesl : I'm struggling to define this as a constant in a helpful way. Is
>> there an example of a similar constant somewhere in the codebase you could
>> refer me to for comparison?
>>
>> I think part of my challenge here is the AWTEventMulticaster doesn't promise
>> to be any particular kind of tree. (For example: if it promised it was a
>> self-balancing tree, then we'd know what our obligations were to meet that
>> expectation.)
>>
>> This PR's implementation is intended to be a fast heuristic/educated guess,
>> but it does not scan the entire height of the left or right node. This makes
>> it ... hard for me to name.
>>
>> (Relatedly: the value 500 is arbitrary, and I'm happy to change it if
>> someone would rather it be closer to 50 or 1000.)
>
> Here is a constant declaration (hotspot friendly):
> https://github.com/bourgesl/jdk-official/blob/d0b770c938be6b5b3a0176148265ef33184a9b8b/src/java.desktop/share/classes/sun/java2d/marlin/Renderer.java#L38
>
> private static final int ALL_BUT_LSB = 0xFFFFFFFE;
'500 iterations' looks high, maybe 100?
It is a recursion ? You could try max recursion depth + 3 samples (first,
middle, last) ?
Or this magic threshold could be tunable ac runtime using special static getter
using a System property + default value, used by constant declaration (final
static is mandatory):
https://github.com/bourgesl/jdk-official/blob/d0b770c938be6b5b3a0176148265ef33184a9b8b/src/java.desktop/share/classes/sun/java2d/marlin/MarlinProperties.java#L50
https://github.com/bourgesl/jdk-official/blob/d0b770c938be6b5b3a0176148265ef33184a9b8b/src/java.desktop/share/classes/sun/java2d/marlin/MarlinProperties.java#L303
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21962#discussion_r1855398578