[Rev 01] RFR: 8238954: Improve performance of tiled snapshot rendering

Frederic Thevenet github.com+7450507+fthevenet at openjdk.java.net
Fri Mar 6 10:46:44 UTC 2020


On Fri, 6 Mar 2020 08:28:34 GMT, Ambarish Rapte <arapte at openjdk.org> wrote:

>> The pull request has been updated with 1 additional commit.
>
> modules/javafx.graphics/src/main/java/com/sun/javafx/tk/quantum/QuantumToolkit.java line 1527:
> 
>> 1526:             private int computeOptimumTileSize(int size, int maxSize, AtomicBoolean isDivExact) {
>> 1527:                 for (int n = 2; n <= 6; n++) {
>> 1528:                     int optimumSize = size / n;
> 
> It would be helpful if you add explanation about the constants 2 and 6 here.

Good point.
I've added the following comment:

>// This methods attempts to find the smallest integer divider for the provided `size`
>// while the result of the division is less than `maxSize`.
>// It tests all potential dividers from 2 to 6 and returns the result of the division
>// if all conditions can be satisfied or, failing that, `maxSize`.
>// The value for `isDivExact` reflects whether or not an exact divider could be found.

Please note that my choice of 6 for the largest attempted divider is totally arbitrary; we ideally want to maximize the chances to find an exact divider, but we also need to avoid making the tiles too small in the process and it seemed a good compromise.

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

PR: https://git.openjdk.java.net/jfx/pull/112


More information about the openjfx-dev mailing list