Note: information in this Chapter is not applicable to the Standard Edition of Excelsior JET.
The memory paging technique, used by many operating systems, creates a considerable overhead on application startup time, because:
Therefore it is desirable to optimize the executable image of the application so as to minimize the number of pages to be loaded on startup and to ensure that the pages are accessed in an order close to sequential. This can be done by profiling the application’s execution and reordering the contents of code and data segments in its executable file. Microsoft Office executables are known to be optimized this way, so they start much faster than typical Visual C++ executables of about the same size. Microsoft Platform SDK used to include a tool called Working Set Tuner for optimizing code layout in C/C++ executables.
Thanks to the Java platform architecture and numerous dependencies between classes, executables created by the JET Optimizer may be quite large, which makes this optimization even more important. Moreover, Java applications have much more static data than C++ applications (e.g. reflection and security information), so there is a need to optimize the data segment as well.
For medium and large applications, the startup optimization results in:
This optimization is adaptive, that is, it requires you to run your application at least once to gather execution profile data. However, you do not need to collect the profile each time you modify your application, because in most cases the startup profile is quite stable. You may wish to recollect it before making the final build for pre-release QA.
With the Startup Optimizer, you can substantially reduce the cold startup time of your Java application, that is, the time it needs to start after a system reboot.
The good news are that you have to do nothing special to enable this optimization. Just run your application once on the page Test Run of the JET Control Panel and then build the executable as usual.
Here is what happens behind the scenes when you do that:
The underlying optimization technique relies on a specific ordering of code and data segments within the resulting executable. For maximum effect, use the Startup Optimizer together with the Global Optimizer.
You may automate the collection of startup profile to include this step in your established build process. For that, you run your Java application with the xjava utility specifying the name of the resulting profile file in the jet.jit.profile.startup property on command line, for example
xjava -Djet.jit.profile.startup=Foo.startup -Xnocache -jar Foo.jar
Upon application exit, the collected information will be written into the specified file created in the application’s working directory. In the example above, the information will be saved to Foo.startup.
Note that if the profile file with the same name already exists, it will not be overwritten, but new information will be added to it.
The profile filename is specified in the project file via the STARTUPPROFILE equation (see STARTUPPROFILE - start up profile file). Provided you performed Test Run at least once, the JET Control Panel adds this equation to the project. If you automate the collecting of the startup profile make sure that the profile filename written in the project is the same as you specified on the xjava command line.