Il 14/07/2009 21:07, Jim Graham ha scritto:

I would set the AA hint or set the composite - one or the other - but
not both. Basically you are looking for the minimum action that causes
an invalidation/revalidation cycle in order to measure the impact. The
more extraneous work in the inner loop, the less impact you will notice
from any overhead the new code might have added.

In both cases I was using debug build (as make debug_build) on an
Intel Core2 Duo T8300 running at full speed (2.40GHz).

I would also compare optimized to optimized as the debug build probably
adds a bit of overhead on its own - again, which could mask any overhead
your changes might have added.

Maybe I should run a more scientific test, but this doesn't look too
bad to me :)

True - it's a nice quick check result, but to be sure it should be done
with minimal test overhead on an optimized build...

...jim

Yes boss :)

[neug...@galactica OpenJDKPerformaceTest]$ ../openjdk/build/linux-amd64/bin/java -cp build/classes/ net.java.openjdk.Main
warmed up run time in ms: 32
total time in ms: 144

[neug...@galactica OpenJDKPerformaceTest]$ ../openjdk-proxy/build/linux-amd64/bin/java -cp build/classes/ net.java.openjdk.Main
warmed up run time in ms: 31
total time in ms: 157

I did various run of this guy, the results are similar, the range of the total time goes from 144 to 158 basically for both OpenJDK version, but the warmed up time is always around 30-32 ms for both, so I don't see any performance degradation.

Btw, the non debug build is *fast*, I never realised this because I'm too used to run debug enabled code, that hotspot does magics is known, but this difference is quite amazing...

I attached the test case but, of course, is really simple. I'm going to do a test run with some real app too, like NetBeans :). The Java2D demo isn't really the fastest thing on Earth with any *JDK version I tried, so it may not be the best use case to spot for performance issues.

Cheers,
Mario
--
Mario Torre, Software Developer, http://www.jroller.com/neugens/
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com   * Tel: +49-721-663 968-44
pgp key: http://subkeys.pgp.net/ PGP Key ID: 80F240CF
Fingerprint: BA39 9666 94EC 8B73 27FA  FC7C 4086 63E3 80F2 40CF

USt-Id: DE216375633, Handelsregister HRB 109481, AG Mannheim
Geschäftsführer: Dr. James J. Hunt

Please, support open standards:
http://endsoftpatents.org/

package net.java.openjdk;

import java.awt.AlphaComposite;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.image.BufferedImage;
import javax.swing.JFrame;

/**
 * Very simple microbenchmark to test performance impact in changes
 * caused by OpenJDK bug #100068.
 *
 * @author Mario Torre <neug...@aicas.com>
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {     

        BufferedImage bimg =
                new BufferedImage(100, 100, BufferedImage.TRANSLUCENT);
        Graphics2D g = bimg.createGraphics();

        long _start = System.currentTimeMillis();
        for (int i = 0; i < 100000; i++) {
            g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                               RenderingHints.VALUE_ANTIALIAS_ON);
            g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                               RenderingHints.VALUE_ANTIALIAS_OFF);
            g.fillRect(0,0,1,1);
        }
        for (int i = 0; i < 100000; i++) {
            g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                               RenderingHints.VALUE_ANTIALIAS_ON);
            g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                               RenderingHints.VALUE_ANTIALIAS_OFF);
            g.fillRect(0,0,1,1);
        }
        
        long start = System.currentTimeMillis();
        for (int i = 0; i < 100000; i++) {
            g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                               RenderingHints.VALUE_ANTIALIAS_ON);
            g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                               RenderingHints.VALUE_ANTIALIAS_OFF);
            g.fillRect(0,0,1,1);
        }
        long stop = System.currentTimeMillis();

        System.out.println("warmed up run time in ms: " + (stop - start));
        System.out.println("total time in ms: " + (stop - _start));
    }

}

Reply via email to