Skip to main content

Performance Analysis at Starting Time

2 replies [Last post]
Joined: 2006-07-04


I am currently developing a software for 3D visualization (and segmentation) of DICOM data. The project grows bigger over time (hopefully big enough to publish it as open source soon), however I would like to look into one issue more closely before. At the current time, the program takes about 3-5 seconds to start, depending on the computer, before the intial window is opened. Any ideas how I can analyse what it does in that time?

There is a complex GUI to build (using nimbus look and feel takes almost 2 seconds longer btw), several static objects to initialize, some look up tables to fill ... how can I profile which method takes the longest time (before the window opens), so that I can see if it can be optimized? Any suggestions (unless its based on manual System.currentTimeMillis() calls) is welcome!

Thanks in advance;

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2005-07-11

Internally at Sun, we provide what we call an 'exit hook' - a -D property or
command line option that tells the application to exit at the point that it reached
basic initialization. This allows your application to startup up and then exit. We
then use standard profiling tools (netbeans profiler for example) and collect
profiles for analysis. This generally won't show JVM related reasons for startup
delays, but it will show application reasons (On Solaris and Linux we use the
Sun Studio analyzer, which will give us native profiles as well as Java level

One thing that may not show up very well in a CPU profile is class dependencies
that result in a sequence of class loads. Lazy initialization of static fields can help
with some of this.

One thing you can do to help the perception of better startup time is to use the
splash screen mechanism to display a splash screen while the application
initializes. You'll see this with a lot of applications, and it goes a long way towards
communicating with the end user that you are actually doing something.


Joined: 2006-07-04

Hello Brian,

thanks for your reply ... it sounds like a good point where to start. Just added the "exit hook", which closes the application to exit after all objects are initialized. Right now, this results in a reproducable EXCEPTION_ACCESS_VIOLATION, seeming to be related to some NVIDIA dll ([nvoglnt.dll+0x289439] sounds like nvidia).

Lazy static initializtaion might be the key ... I think I know several classes where I should take a look if the static fields initialization can be delayed. You never notice at the beginning of the developement with only few lines of code, but over the weeks it sums up.

Thanks a lot,
ChaosE / Ingo