I posted this message first on Java Discuss and was asked to file a Java bug. It was also suggested I post it here for discussion.
I've recently started using Java 11 and noticed that drawPolyline is much slower on my PC than it was on Java 8. Example, simplified code: @Override protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D graphics = (Graphics2D) g; long starttime = System.nanoTime(); graphics.drawPolyline(xs, ys, xs.length); long endtime = System.nanoTime(); Logger.getLogger(this.getClass().getName()).log(Level.INFO, "Paint Time: {0}s", (double)(endtime-starttime) / 1.0e9); } where xs[] and ys[] are large (65536 points) integer arrays. On Java 8 I get a paint time of 0.025s and on Java 11 it is 25s, i.e. factor of 1000. This may be related to JEP263 (HiDPI) I've got a recent Core i7 processor with Intel graphics, running Windows 10. With VisualVM I can see that all the time goes in drawPolyline, I can't get any more detail than that. I have done some experimentation with RenderingHints but nothing makes the JDK11 go as fast as JDK8. Is there anything else I can try to either improve matters or to provide a clearer idea of why there is such a difference? I have a self-contained NetBeans project if anyone wants to try to see they can reproduce this. https://github.com/pedro-w/PolylineTest.git Thanks, Peter Versions: openjdk version "11" 2018-09-25 OpenJDK Runtime Environment 18.9 (build 11+28) OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode) openjdk version "1.8.0-adoptopenjdk" OpenJDK Runtime Environment (build 1.8.0-adoptopenjdk-_2018_05_19_00_59-b00) OpenJDK 64-Bit Server VM (build 25.71-b00, mixed mode)