Java Performance Tuning
Java(TM) - see bottom of page
Our valued sponsors who help make this site possible
JProfiler: Get rid of your performance problems and memory leaks!
Training online: Concurrency, Threading, GC, Advanced Java and more ...
Question of the month: Profiling Applets
JProfiler
|
Get rid of your performance problems and memory leaks!
|
JProfiler
|
Get rid of your performance problems and memory leaks!
|
|
|
Back to newsletter 041 contents
There are several ways to profile an applet.
- Manually stick timing code into the various method calls and find out where the time is
going by analyzing that data (output according to some scheme of your own). This is not recommended
unless none of the other ways can be made to work.
- Run using the appletviewer (should be in your JDK "bin" directory), passing any profiler parameters using the -J parameter,
for example
appletviewer -J-Xrunhprof:cpu=samples myappletpage.html
or appletviewer -J-Xprof myappletpage.html
.
- Run the applet in a normal JVM using the Sun appletviewer class (sun.applet.AppletViewer), and using whatever profiler you want
operating as normal for any JVM. For example
java -Xrunhprof:cpu=samples sun.applet.AppletViewer myappletpage.html
or
java -Xprof sun.applet.AppletViewer myappletpage.html
.
- Run the applet in your preferred browser and figure out how to connect your preferred profiler to the Java plug-in or embedded
JVM. This last seems to be difficult to do, and only some profilers will work with some browsers. You need to check with your profiler
vendor to figure out how to do this, though it may be a FAQ so there could be a simple set of instructions to follow.
Beyond the technicalities, there is nothing special about profiling applets: the code needs to be optimized
in the same way any Java program would be optimized. There are a couple of extra concerns to do with applet
download and startup time, which means that you want to have the applet and all support resources in a compressed jar
file. Although even better is to have the applet start up with almost no resources and minimal class
file content, i.e. as fast as possible, then for it to download all further resources it needs while
keeping the user occupied or entertained.
The JavaPerformanceTuning.com team
Back to newsletter 041 contents
Last Updated: 2024-11-29
Copyright © 2000-2024 Fasterj.com. All Rights Reserved.
All trademarks and registered trademarks appearing on JavaPerformanceTuning.com are the property of their respective owners.
Java is a trademark or registered trademark of Oracle Corporation in the United States and other countries. JavaPerformanceTuning.com is not connected to Oracle Corporation and is not sponsored by Oracle Corporation.
URL: http://www.JavaPerformanceTuning.com/news/qotm041.shtml
RSS Feed: http://www.JavaPerformanceTuning.com/newsletters.rss
Trouble with this page? Please contact us