<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Hi Peter,</div><div><br></div><div>I confirm that HiDPI support is causing your problem.</div><div><br></div><div>On linux (xrender), I added -Dsun.java2d.uiScale=2.5 and the performance becomes poor ~ 3.3s vs 0.03s !</div><div><br></div><div><span style="font-family:monospace,monospace">java -Dsun.java2d.uiScale=2.5 -DuseAA=false -jar dist/PolylineTest.jar<br>Java: 11 11+28<br>oct. 11, 2018 1:02:00 PM polylinetest.Canvas paintComponent<br>INFO: Paint Time: 3,781s<br>oct. 11, 2018 1:02:03 PM polylinetest.Canvas paintComponent<br>INFO: Paint Time: 3,003s<br>oct. 11, 2018 1:02:06 PM polylinetest.Canvas paintComponent<br><b>INFO: Paint Time: 3,318s</b></span></div><div><span style="font-family:monospace,monospace"><br></span></div><div><span style="font-family:monospace,monospace">java -jar dist/PolylineTest.jar <br>Java: 11 11+28<br>oct. 11, 2018 12:50:33 PM polylinetest.Canvas paintComponent<br>INFO: Paint Time: 0,073s<br>oct. 11, 2018 12:50:33 PM polylinetest.Canvas paintComponent<br>INFO: Paint Time: 0,037s<br>oct. 11, 2018 12:50:33 PM polylinetest.Canvas paintComponent<br><b>INFO: Paint Time: 0,029s</b><br></span><br></div><div><br></div><div>I enabled antialiasing hint to use Marlin renderer and performance is slightly better ~1.9s vs 3.3s.<br></div><div><span style="font-family:monospace,monospace">Java: 11 11+28<br>oct. 11, 2018 1:01:27 PM polylinetest.Canvas paintComponent<br>INFO: Paint Time: 2,304s<br>oct. 11, 2018 1:01:29 PM polylinetest.Canvas paintComponent<br>INFO: Paint Time: 1,911s<br>oct. 11, 2018 1:01:31 PM polylinetest.Canvas paintComponent<br><b>INFO: Paint Time: 1,881s</b></span><br><br></div>Moreover, your polyline is very complicated (65K segments) so AWT (c code) may have troubles in contrary to the Marlin renderer (pure java - AA optimized code), that is faster and performs AA computations (8 times more sampling).<div><br></div><div>I performed quick profiling using linux perf:</div><div><span style="font-family:monospace,monospace">perf record -g java -Dsun.java2d.uiScale=2.5 -jar dist/PolylineTest.jar</span></div><div><br></div><div><span style="font-family:monospace,monospace">Samples: 58K of event 'cycles:ppp', Event count (approx.): 48668354960, DSO: libawt.so<br>  Children      Self  Command          Symbol                                                                  ◆<br><b>+   74,35%     0,00%  AWT-EventQueue-  [.] Java_sun_java2d_pipe_ShapeSpanIterator_nextSpan                     ▒<br>+   74,35%    74,10%  AWT-EventQueue-  [.] ShapeSINextSpan                                                     ▒<br>+   10,00%     0,05%  AWT-EventQueue-  [.] Java_sun_java2d_pipe_ShapeSpanIterator_lineTo                       ▒</b><br>     0,22%     0,22%  AWT-EventQueue-  [.] sortSegmentsByLeadingY                                              ▒<br>     0,14%     0,14%  AWT-EventQueue-  [.] appendSegment                                                       ▒<br>     0,08%     0,00%  java             [.] Java_sun_java2d_loops_GraphicsPrimitiveMgr_initIDs                  ▒<br>     0,04%     0,04%  AWT-EventQueue-  [.] subdivideLine.isra.0                                                ▒<br>     0,03%     0,00%  java             [.] AWT_OnLoad                                                          ▒<br>     0,03%     0,00%  java             [.] AWTIsHeadless                                                       ▒<br>     0,02%     0,02%  AWT-EventQueue-  [.] GetSpanData                                                         ▒<br>     0,02%     0,00%  java             [.] Java_sun_java2d_SurfaceData_initIDs                                 ▒<br>     0,01%     0,00%  AWT-EventQueue-  [.] initSegmentTable                                                    ▒<br>     0,01%     0,00%  java             [.] Java_sun_java2d_loops_GraphicsPrimitiveMgr_registerNativeLoops      ▒<br>     0,01%     0,01%  AWT-EventQueue-  [.] free@plt                                                            ▒<br>     0,00%     0,00%  java             [.] RegisterPrimitives                                                  ▒<br>     0,00%     0,00%  Java2D Disposer  [.] SurfaceData_DisposeOps                                              ▒<br>     0,00%     0,00%  AWT-EventQueue-  [.] memcpy@plt                                                          ▒<br>     0,00%     0,00%  AWT-EventQueue-  [.] calloc@plt                                                          ▒<br>     0,00%     0,00%  java             [.] InitSimpleTypes.constprop.0                                         ▒<br>     0,00%     0,00%  java             [.] MapAccelFunction                                                    ▒<br>     0,00%     0,00%  java             [.] Java_sun_java2d_pipe_SpanClipRenderer_initIDs                       ▒<br></span></div><div><br></div><div><div>I suspect that HiDPI implies software rendering instead of accelerated rendering (xrender drawline, AFAIR).</div><div><br></div><div>However, I am not sure such performance issue can be fixed any time soon.</div><div>Workaround: use <span style="font-family:monospace,monospace">-Dsun.java2d.uiScale=1.0</span><br></div></div><div><br></div>Regards,</div><div>Laurent<br></div></div></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr">Le jeu. 11 oct. 2018 à 10:30, Peter Hull <<a href="mailto:peterhull90@gmail.com">peterhull90@gmail.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I can answer part of that, but I can't get access to the older system just now.<br>
<br>
On Wed, Oct 10, 2018 at 4:41 PM Philip Race <<a href="mailto:philip.race@oracle.com" target="_blank">philip.race@oracle.com</a>> wrote:<br>
> In other words does<br>
><br>
> -Dsun.java2d.uiScale=1.0<br>
><br>
> even change the physical size of the window on JDK 9/10/11 ?<br>
><br>
Yes, because I can run the same jar under Java 8 and 11. Without the<br>
scale option, the Java 11 window is bigger than the Java 8 one, by<br>
about 1.25x (this corresponds to my system setting)<br>
When I add the scale=1 option to both, they are both the same size<br>
(and the same as JDK8 without any scaling)<br>
I've attached 2 images so you can see what I mean, one is without any<br>
scale option (and I labelled the approx size on this) and the other is<br>
with -Dsun.java2d.uiScale=1.0.<br>
The window title contains the system property "java.runtime.version"<br>
so you can see which is which.<br>
<br>
I do appreciate your help on this. It looks like it's coming down to<br>
Intel's graphics driver, do you agree?<br>
<br>
Pete<br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">-- <br>Laurent Bourgès</div>