File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes How to optimize? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to optimize?" Watch "How to optimize?" New topic

How to optimize?

Maki Jav
Ranch Hand

Joined: May 09, 2002
Posts: 438
Hi all,
I want to ask how to optimize my swing/awt application? What points to keep in mind?
My application uses JInternalFrames, connections to SimpleText database
and static loading of variables.
Thanx in advance,
Maki Jav

Help gets you when you need it!
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

Optimize for what?
For size, for speed, for usability, for extendability?
Optimisation is the source of all evil (D. Knuth [from memory]).
Mostly, optimisation is meant for speed, if not suggested otherwise.
And mostly optimisation for speed will make the programm:
- harder too read and maintain
- bigger
- harder to extend
- harder to port
Therefore optimisation for speed should be avoided if possible.
Where speed-problems encountered?
If yes, you should start with a profiler, finding the bottleneck, since often only a small amount of code is guilty for consuming much time, and only this is a candidate for optimisation.
Another answer could be: rewrite it in asm
Or implement it in hardware
Nathaniel Stoddard
Ranch Hand

Joined: May 29, 2003
Posts: 1258
GUI applications are for the most-part IO-bound anyways. So, it's not like you'd be able to optimize it at all. That is unless you have some giant calculation that it actually does at some point. Thus, the profiler comment by Stefan.
The real question though is: is the program running too slow, or are you just wanting it to run faster because you can? Optimization is always in context of user needs. And therefore if the user is happy, then it is already optimized.

Maki Jav
Ranch Hand

Joined: May 09, 2002
Posts: 438
Well! the optimization that I sought was about speed.
My program is not that slow. And database queries get you result in about 1 second (I am using SimpleText Database). The JOptionePane.showMessgae() that I am using to show property(realestate) details opens quite quickly.
I see no such problems which might upset my user. The only minor problem could be the extra black dos-prompt screen that opens when it starts.
Maki Jav
Eddie Vanda
Ranch Hand

Joined: Mar 18, 2003
Posts: 281
use "javaw" instead of "java" when you start your app

The nice thing about Standards is that there are so many to choose from!
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

Or google for 'splashscreen' and 'java'. Show a nice logo at startup.
I agree. Here's the link:
subject: How to optimize?
It's not a secret anymore!