During the review of the Unsafe --> FFM conversion in JavaFX a few potential optimizations were noted. Specifically:
1. Optimize alpha map creation:
I guess this is only done once, but following multiple layers of calculation I think this array defaults to 64K long, in which case a bulk copy would be better, but it is perhaps out-of-scope for a 1:1 replacement
https://docs.oracle.com/en/java/javase/24/docs/api/java.base/java/lang/foreign/MemorySegment.html#copy(java.lang.Object,int,java.lang.foreign.MemorySegment,java.lang.foreign.ValueLayout,long,int)
2. Unneeded reference to ALPHA_MAP and ALPHA_MAP_AA arrays
MaskMarlinAlphaConsumer.java L110: is ALPHA_MAP needed to keep the parent reference in OffHeapArray? if so, why not use a single Object instead of an array?
1. Optimize alpha map creation:
I guess this is only done once, but following multiple layers of calculation I think this array defaults to 64K long, in which case a bulk copy would be better, but it is perhaps out-of-scope for a 1:1 replacement
https://docs.oracle.com/en/java/javase/24/docs/api/java.base/java/lang/foreign/MemorySegment.html#copy(java.lang.Object,int,java.lang.foreign.MemorySegment,java.lang.foreign.ValueLayout,long,int)
2. Unneeded reference to ALPHA_MAP and ALPHA_MAP_AA arrays
MaskMarlinAlphaConsumer.java L110: is ALPHA_MAP needed to keep the parent reference in OffHeapArray? if so, why not use a single Object instead of an array?
- relates to
-
JDK-8334137 Marlin: replace sun.misc.Unsafe memory access methods with FFM
-
- Resolved
-