On Fri, 13 Mar 2020 17:24:02 GMT, Ambarish Rapte <ara...@openjdk.org> wrote:
>> Frederic Thevenet has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Avoid useless width and height calculation > > modules/javafx.graphics/src/main/java/com/sun/javafx/tk/quantum/QuantumToolkit.java > line 1600: > >> 1599: } >> 1600: } >> 1601: } > > The `if (exactHeightDivFound.get())` and `else` block here look effectively > same. Could you please take a re-look or > explain what am I missing here. Functionally, both side of the condition actually do the exact same thing, but the side effects of which dimension is processed in the inner loop sometime have measurable consequences in terms of performances; I've added the following comment to the code to better explain this: // In order to minimize the number of time we have to resize the underlying // surface for capturing a tile, choose a dimension that has an exact divider // (if any) to be processed in the inner most loop. // E.g. looping on width then height in the example bellow requires four // surface resizing, whereas the opposite requires only two: // // for (w;;) for (h;;) // for(h;;) for(w;;) // ----------------- ----------------- // | | | | | | // | 1 | 3 | | 1 | 2 | // h | | | h | | | // ----------------- ----------------- // | 2 | 4 | | 3 | 4 | // ----------------- ----------------- // w w ------------- PR: https://git.openjdk.java.net/jfx/pull/112