Skip to main content

Profiler Milestone 8 Now Available

Posted by gsporar on August 14, 2005 at 12:18 PM PDT

The NetBeans Profiler team continues to make progress. Milestone 8 is now available and it has some nice features. The most important one to me is the automatic exclusion of server code when profiling a web application. This is just the default - you can enable profiling of the server's code if you want. I'll write more on this feature after I've had some time to experiment with it. Full details on the features in Milestone 8 are available here.

I used the latest Profiler milestone to do a bit of benchmarking. This all started with a blog entry I wrote about Project Matisse. There was a comment to that entry by teilo, who complained about the inefficiency of the generated code. One of the specific complaints was that the ResourceBundles were not being cached. I responded by pointing out that the ResourceBundle class itself has a cache, so it seems that an additional cache in the application is not needed.

In a follow-up comment, teilo pointed out a couple of things. For one thing, this makes Project Matisse dependent on the implementation of ResourceBundle in order to get the performance boost. I'll gladly concede that point - I was basing my analysis on the ResourceBundle in Sun's reference implementation of the JDK. I suspect that other implementations are similar, but I don't know for certain.

The other point was that the code could still be more efficient if it did not make repeated calls to ResourceBundle.getBundle(). This is where the profiling begins. I wrote a small sample application that contains just the resource lookups from my Project Matisse sample application.

package resourcecachetest;
public class Main {
    public Main() {
    private static void matisseApproach()
        // this is what Matisse produces:
    private static void teiloApproach() {
        java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("resourcecachetest/FindDemo");
     * @param args the command line arguments
    public static void main(String[] args) {

As shown above, the code doesn't do anything because both methods are commented out. I profiled it both ways: with just the call to matisseApproach() un-commented and then again with just the call to teiloApproach() un-commented. I was careful to do a complete system restart before each test in order to do a fair comparison. I tested on both my 3GHz Pentium desktop and my 1.8GHz Pentium M laptop. The results were the same on both machines: there is no significant performance difference.

The Profiler output for the Project Matisse version shows that the matisseApproach() method took 44 milliseconds to complete:


The Profiler output for the teiloApproach() method shows that it took 44.5 milliseconds to complete: