Il 09/07/2009 22:23, Jim Graham ha scritto:

- pipe interfaces implement a new interface "LoopBasedPipes" which has
no methods, it is just a "marker" interface. The test in validate() just
uses instanceof in this case which might be faster than an interface
method dispatch (actually, it almost certainly would be).

Hi Jim,

http://cr.openjdk.java.net/~neugens/100068/webrev.05/

I did it with the interface. Actually, I could not spot any real difference, but maybe I'm doing a micro benchmark.

I tried to figure out some "common" use case, so i did this (based on your suggestion too), I found this combination to force the pipe to be invalidated:

BufferedImage bimg =
        new BufferedImage(100, 100, BufferedImage.TRANSLUCENT);
Graphics2D g = bimg.createGraphics();
for (int i = 0; i < 100000; i++) {
  g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                     RenderingHints.VALUE_ANTIALIAS_ON);
  g.setComposite(AlphaComposite.getInstance(
                 AlphaComposite.SRC_OVER, 0.5f));
  g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                     RenderingHints.VALUE_ANTIALIAS_OFF);
  g.setComposite(AlphaComposite.getInstance(
                 AlphaComposite.SRC_OVER, 1.0f));
  g.fillRect(0,0,1,1);
}

I do this loop 3 times, so to make hotspot warm up first.
After some runs, I get this as an average (well, manually rounded to be honest):

warmed up run time in ms: 614
total time in ms: 2189

With "plain" OpenJDK I get similar results.

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 used the "almost latest" OpenJDK code drop, with changeset ID a50217eb3ee1.

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

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/

Reply via email to