Graphics2D.drawPolyline performance on JDK 8 vs. JDK 11 (repost)

Peter Hull peterhull90 at gmail.com
Tue Oct 9 09:00:03 UTC 2018


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
OpenJDK8_x64_Win_jdk8u172-b11 I get a paint time of 0.025s and on
openjdk-11+28_windows-x64 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.

Is this a bug do you think and if so, where to report it?

Thanks,
Peter


More information about the discuss mailing list