RFR: 8282526: Default icon is not painted properly [v4]

Sergey Bylokhov serb at openjdk.java.net
Thu Jun 2 00:12:30 UTC 2022


On Fri, 27 May 2022 18:12:59 GMT, Alexander Zuev <kizune at openjdk.org> wrote:

> On 10000 iterations the difference is measurable in tens of milliseconds between test runs. On 100000 iterations test execution with BICUBIC approximation is noticeable (like test run takes more than a second longer).

Not an ideal benchmark but it shows that the bicubic is ~200 times slower.

public static void main(String[] args) {
        var gc =
                GraphicsEnvironment.getLocalGraphicsEnvironment()
                                                  .getDefaultScreenDevice()
                                                  .getDefaultConfiguration();
        var vi = gc.createCompatibleVolatileImage(50, 50,
                                                  Transparency.TRANSLUCENT);
        var bi = new BufferedImage(50,50,BufferedImage.TYPE_INT_ARGB);
        Graphics2D g2d = vi.createGraphics();
        g2d.scale(2,2);
        test(bi, g2d);// warmup
        test(bi, g2d);
        g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
                             RenderingHints.VALUE_INTERPOLATION_BICUBIC);
        test(bi, g2d);// warmup
        test(bi, g2d);
    }

    private static void test(BufferedImage bi, Graphics2D g2d) {
        long start = System.nanoTime();
        for (int i = 0; i < 1000; ++i) {
            g2d.drawImage(bi, null, 0, 0);
        }
        long time = System.nanoTime() - start;
        System.out.println("Time: " + time);
    }

Time: 21313400
Time: 4036200
Time: 1140613100
Time: 839499200

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

PR: https://git.openjdk.java.net/jdk/pull/7805



More information about the client-libs-dev mailing list