How to approach Java 2D performance changes between different computers?

I was developing a card game in Java on Windows. It works great on my laptop and several others, but on many other systems (even several new ones, Mac and Windows) the animation is incredibly slow.

I found the UI Toolkit for Java as the best resource so far, but could not achieve significant improvement, I am using AWT / Swing libraries.

Question:
Looking at my game , (<1.5Mb), how could it be that on some computers (of a similar specification) the performance seems much less than what it is on my laptop? The entire application is event driven, and I did most of the optimization that I could do based on the implementation.

I have a feeling that it is connected with memory. I create (compatible), and then save all my images in an array at the beginning, and then reference them.

Note. I decided to make this game so that I could learn and practice new ideas, so I'm not just trying to share it - I am really interested to know what is happening here.

+7
source share
4 answers

On some operating systems, the Java 2D rendering pipeline does support hardware acceleration using the GPU. It depends on the Java implementation you are using.

One of the new features for implementing Oracle Java SE 7 (which is coming out at the end of the month) is: the XRender pipeline for Java 2D , which means that it will have much better 2D graphics performance on Linux.

On Windows, in the Java SE 6 10 update, some improvements improved 2D 2D performance with Direct3D hardware acceleration ( source ).

+5
source

For Macs, you should try the system propositions and rendering tips described in this document , especially the one that tells Java to use the native Quartz renderer, not the Sun render.

+3
source

.. why can it happen that on some computers the performance seems to be at least half of what I have on my laptop?

Video Drivers I have long been involved in a stream on usenet, where there was a phenomenal difference in rendering speed on machines with a similar specification. Ultimately, it was concluded that some machines used outdated video drivers, and this was the main reason for the difference.

If this turns out to be the case, it is best to do a rendering test. Check the FPS, and if it is too low, advise the user to update the drivers.

+3
source

Try putting it in a profiler and see what happens. I would do it both on windows and on mac and compare where exactly you are getting the problem. JProfiler is my favorite, but YourKit is good. You can get a trial version within 30 days, which should be enough time to understand this.

Perhaps this is due to graphics hardware, hardware acceleration, and software, as there is a difference between the Mac and Windows in this thread.

+1
source

All Articles