Java2D benchmarks

I was looking for a Java2d benchmark but i wasn’t able to find one.

Have you got some ?

I’m going to write my very own one. Suggestions welcome.

I have some ideas of the benchmark:

  • [image|text|primitives] to screen;
  • [image|text|primitives] to offscreen image;

Variants:
clipping on/off
antialiasing on/off
interpolation on/off
transform on/off
n of loops
image size
composite selection

Mik

Opaqe vs 1 bit transparency vs translucency in images/primitives would be nice. :slight_smile:

Cheers,
Mikael

We have an internal benchmark which does all that (and is very extensible, so it’s easy to add new tests), it would be interesting to see if we can open it up…

So, what are you waiting for ?

Mik

Since it’s internal Sun stuff I guess he must have an approval from someone in the management. :slight_smile:

Well, while waiting for the long times of the burocracy I keep working on my own java2d benchmark.
Far from being nice, expandable, well designed like the SUN one, the first beta should be complete this night.

Source code will the there, so anyone can hack it…

Mik

It might be a good idea to use something like jUnit to structure the tests - that would get you the extensibility. I’m just not sure how jUnit works for non-pass/fail sorts of tests where you really just want a more general measurement… I would figure that is handled by jUnit as well.

It would be great if the results, including some comments about the platform, was serializable to a XML-file so that people can share their results.

Also, to get wide acceptance it would be good to have a default test suite, where most, if not all, are tested and just one or a couple of results was presented.

It is imperative that the program is easy to use, so that a LOT of people use it, so it becomes useful… :wink:

Also some more more ideas of the top of my head:

  • web page to present results from around the globe
  • webstartable! (JWS)
  • Different test-windows sizes (painting primitives that are translucent and above a certan size kills performance quite a lot. Never found a hard limit though.
  • Memory consumption would be good to know.
  • Performance chart over time would also rock. JFreeChart…

There’s absolutely a hole to fill here, wonder why this haven’t been done before!?

Cheers,
Mikael

I would take a long hard look at JMeter (apache/jakarta) before creating a full-blown harness for this.

JMeter was designed to do a lot of this kind of stuff, although at the moment most of the plugins are for doing network testing - request/response etc - but it comes with many visualizer plugins already, and would save a LOT of time and give you a lot of features for free if you could sensibly integrate into it by writing a plugin for the j2d tests.

Although, in classic style, the documentation is rubbish - and in fact non-existent for about 50% of the thing last time I looked. Stupid, stupid stupid. I am constantly amazed that it never occurs to people who do this that the major barrier to people contributing to the project is that they haven’t bothered to document it, and so it’s only their own lack of input that is keepin other volunteers out :(.

[quote]We have an internal benchmark which does all that (and is very extensible, so it’s easy to add new tests), it would be interesting to see if we can open it up…
[/quote]
In fact, after some quick discussion we decided that it would indeed be useful to open up our benchmark to the community. We’ll go through the necessary legal stuff, but hopefully we can have it up on java.net in the next few weeks… Thanks for the good idea…

Chris

Chris, would it be possible to add it as a project (Open Source) so stuff can be added? Can you also make a quick recap of its features? Is it user friendly?

Cheers,
Mikael

[quote]Chris, would it be possible to add it as a project (Open Source) so stuff can be added? Can you also make a quick recap of its features? Is it user friendly?

Cheers,
Mikael
[/quote]
Hi Mikael,

Yes, the whole point was that we’d be releasing this as an open source project (probably BSD-style license) on java.net… It has a comprehensive UI (all the knobs can be controlled from the Swing controller app), but don’t expect anything pretty. Results are stored in an XML file and can be compared using a companion “analyzer” application. The framework includes many of the features you and Mik were looking for, but it would be great if you could work on adding the features you requested (the charting and WebStart features would be very useful). I’ll post when the project is made public.

Thanks,
Chris

As promised I’m releasing the first alpha release of my little tiny j2d benchmark. The benchmark has been developed for internal testing so it could be completely unuseful for the people here.

My main aim is to test the performance of various blitting/transforming aspects of java2d. The usage is straightforward: click RUN and play with the gui. The result of the test is a little ops/s number that shows the number of operations per second. The timing is inaccurate but gives an idea. No auto-test-report at all for the moment.

The jar is HERE: http://www.classx.it/public/j2dbenchmark.jar , along with the sources. You can start it with a double click or through the command line with:

java -cp j2dbenchmark.jar -Dsun.java2d.translaccel=true -Dsun.java2d.ddforcevram=true -Dsun.java2d.opengl=True j2dbenchmark.J2DBenchmark

I still have to implement support for text, glyphs, primitives, clipping, stroke, fill.

Comments, improvements welcome.

p.s.
Thanks Chris, you’re welcome as usual!

On Mac OS X 10.3.4 Java 1.4.2 every tests shows the same plain blue frame… the op/s number is updating, but I can’t really tell what is going on. Are you drawing blue on blue :slight_smile: ?

Oops, I forgot to write the users guide :wink:

Just feel like a hacker and play with the gui. You’ll be able to discover that something will appear in the blue frame as soon as you choose:

Src: whatever
Dest: onscreen JFrame
Composite: AlphaComposite.SrcOver

on my machine this gives 224 ops/s

If you choose another dest, then you’re testing the speed of blitting from one image type to another one.

Src: Translucent Managed BufferedImage
Dest: Translucent Managed BufferedImage
Composite: AlphaComposite.SrcOver

on my machine this gives 360 ops/s (Athon 1.8 - ATI Radeon 7000)

the same test with OpenGL enabled gives 420 ops/s (some extra FPS in real world apps? Not really. Enabling the rotation I get 200 ops/s which is almost exactly the same number I get without opengl. Does this mean that transforms are not accelerated ?)

Let me know you numbers on Mac.

Mik

Blitting to a Managed image will never be accelerated (as the master copy of the image is not stored in vram).
You should blit from a Managed image to a VolatileImage if you want to see HW acceleration in action.

And hw blitting from managed to managed is what I need.

Why don’t you add some code for Volatileimage blitting to the benchmark ?