Sign in to follow this  

Java Application running SLOW on Mac

This topic is 4757 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I am new to the Macintosh environment and was wondering if someone could help me here. I have written a java application (stand-alone) on a Windows platform. The application is computation intensive and uses Java3D APIs to render 3D objects. Also, the application uses JSci APIs to render 2D graphs and has a number of other features, which use extremely large arrays. The application is built using Swing APIs whereever possible. Now, when I run the application (jar) on a Windows platform (XP), it runs fine as expected. However, when I run the same application on Mac OS X (10.3.5), it runs extremely slow, takes ages to render 3D objects or to do anything as a matter a fact. In summary, the application runs much much faster on Windows (Intel P4 - 1.4 GHz, 768MB RAM) as compared to running it on a Dual 1.42 GHz PowerPC G4 with 1GB RAM. This does not make sense to me. Any insight/help would be highly appreciated. Thanks in advance.

Share this post


Link to post
Share on other sites
Ok... chances are your problem is GPU bound in the sense that the bottlenecks are in your display logic.

Check the state of Java3D's support for Mac hardware accelerated 3d graphics...

If this is causing you grief... it might be better to use JOGL - a java to openGL binding... ogl is a little more "primative" thatn Java3D, but because it is a bindings layer... you can be guaranteed that it's trying ot use hardware acceleration. Java3D tries to do some magic... whereby it will use acceleration IF IT detects there is a suitable platform. Otherwise, it will just do it in software, and that's where the slowdowns start. Generic microprocessors (x86 hardware) just doesn't cut it for realtime 3d graphics... hence the need for GPUs.

Java can be made to run pretty fast... the hotspot optimising jvms really do a pretty good job to cache machine generated instructions rather than interpret them. It will never be as fast as native C/C++ but the productivity gains are there... so if saeenali is doing something scientific or other where you're looking at algorithms and how they work rather than optimising for a specific game, Java would make sense.

One other thing... Swing is a very slow GUI platform. Consider using jogl to render out your graphs and what not. Alternatively, consider the framework from eclipse.

Share this post


Link to post
Share on other sites
In my experience the performance of a Java app does depend pretty heavily on the JVM it's running on. Have you installed all available updates for the Mac JVM?

Share this post


Link to post
Share on other sites
Quote:
Original post by philvaira
When/where is Java considered fast?


Since about 4 or 5 years ago in places where people actually know what they are talking about.

Quote:
Original post by saeenali
Any insight/help would be highly appreciated.


It could very well be that the Java3D mac implementation is broken. I suggest you check out Xith3D. See if the demos run on that Mac system. If so, you might consider using it rather than Java3D. It's a Java3D-like scenegraph engine that is geared toward games. Also check out jME (another scenegraph API based on David Eberly's work). And in the future you might consider posting Java questions at the javagaming.org forums where you can avoid the ignorant trolls. There's a section there specifically for Java3D.

Share this post


Link to post
Share on other sites
Have you tried poking around at it with a profiling tool? Can you tell whether or not it's getting an accelerated context?

Quote:
One other thing... Swing is a very slow GUI platform. Consider using jogl to render out your graphs and what not. Alternatively, consider the framework from eclipse.
It is also likely true that Apple's Aqua Look-and-Feel is slower than other implementations. This document has instructions for changing the LAF on MacOS X.

Share this post


Link to post
Share on other sites
When your app starts up, check the OS. If it's OSX, turn off your double buffering code!

Aqua automatically double buffers all windows, effectively giving you triple buffering if you have your own double buffer code.

I don't know if this is the source of your problem, but it's something to be aware of.

Share this post


Link to post
Share on other sites
Quote:
Original post by superpig
In my experience the performance of a Java app does depend pretty heavily on the JVM it's running on. Have you installed all available updates for the Mac JVM?


Yeah check for JVM updates. I wrote a small pong like game a few months ago and when sun updated to 1.5 the game runs unplayably fast. Remember kids, if you make your update events frame-dependent instead of time-dependent like you're supposd to, instead of bringing you toys Santa will shoot you. :P

Share this post


Link to post
Share on other sites
Apple Software Update usually catches JVM updates. There's no Java 5 for Mac yet... I think Apple's holding out on us until Tiger (haha). 1.4.3 seems plenty fast on my computer, but Java 5 is pretty quick on my 440Mhz UltraSPARC II.

Share this post


Link to post
Share on other sites

This topic is 4757 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this