VisualVM: A free profiler for Java
Currently I am developing for Android, and my code really uses a lot of processing power to do it’s job. A good profiler can really help with finding hotspots that you can eliminate or optimize.
On StackOverflow there are 2 good questions on the subject of profilers for Java. Most of the profilers however are quite user-unfriendly or expensive. Fortunately one of the suggested profilers is really good: VisualVM
VisualVM is a standalone profiler for Java. It is also used integrated into NetBeans, but for those working in Eclipse, a simple plugin is available that let you launch the profiler. It is also part of the Java JDK, but that version is quite old, so you better download the most recent one from their website.
Only problem I have with VisualVM is it’s inability to defer launching of the app until profiling is started. Now I need to make my program sleep for 10 seconds while I start the CPU profiling. In NetBeans this is not the case. I guess it’s the benefit of integration. Other than this little downside, VisualVM works great! Really recommended.