Measure your application's size in memory and its execution speed.
Measuring performance throughout construction can help to identify major performance problems as quickly as possible, which is almost always beneficial. If a major problem becomes apparent, then some immediate redesign will likely be necessary. If no major problem is apparent, then, if needed, minor optimizations can be performed later, when construction is nearly complete. (Many would argue that worrying about minor optimizations during construction is not advisable, since optimizations can sometimes make code more obscure.)
The excellent JConsole tool comes with JSE 6, and can be used to manage and monitor a local or remote Java Virtual Machine.
If JConsole is not available, there are some other means of measuring an application's size in memory. They depend on your platform. For example:
- NT : Task Manager, look for java.exe or javaw.exe
- Unix : get the process id "ps -e | grep java", pass it to pmap, as in "pmap -x 6598", and look for total KB entry in the Private column
As well, the JDK itself comes with basic profiling tools. For example :
- Runtime.freeMemory()
- Runtime.totalMemory()
- java -Xprof MyClass
- java -Xrunhprof:[options] MyClass
|
|