On Fri, 2 Aug 2024 21:22:09 GMT, John Hendrikx <jhendr...@openjdk.org> wrote:

>> Michael Strauß has updated the pull request incrementally with two 
>> additional commits since the last revision:
>> 
>>  - fix since tag
>>  - adjust table styling
>
> modules/javafx.graphics/src/main/java/com/sun/javafx/util/Utils.java line 230:
> 
>> 228:      * shallow-equal to the list that is passed into this method, i.e. 
>> its elements are references
>> 229:      * to the same objects. The existing list is returned in this case.
>> 230:      */
> 
> Was there a performance problem here?
> 
> Allocating 8 locals should be equivalent to an array of 8 elements that never 
> escapes (ie. JIT optimizes this). Then either JIT is smart enough to 
> conditionally allocate a heap object and copy the array there, or you can 
> help it by cloning that local array and letting only the clone escape.

There's no performance problem in the sense that my test application runs 
slowly in any noticeble way. It's one more piece of trying to minimize the 
allocation of objects in the very common case where nothing has changed.

Do you think it is preferrable to appeal to JIT magic instead of explicitly 
coding the behavior? With your other suggestion of using `switch`, the code 
looks much cleaner already.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1522#discussion_r1702668699

Reply via email to