Profiling NetBeans 6 Beta – Using Itself!

The NetBeans 6 Profiler is a great tool for developers to use to diagnose performance
problems in code. In this article, I examine the performance of the NetBeans 6 IDE
Beta by profiling it with itself.

System Configuration :

Laptop with Windows XP,SP2
Single-processor, single core Pentium M 1.6 Ghz,
1 GB RAM

Sun Java 1.6.0_02

I started NetBeans 6 Beta 1 (official release, not a daily build). I won”t measure startup time, since everyone”s differs based on the number of modules they have installed. NetBeans startup time is still a little slow, but has been improving with each release.

The Projects window has 1 Java Application project open and the Source Editor window has 1 very small Java class open it in.

Current memory status reported by Memory Window in main toolbar : 32 / 48 MB

In the Java source file open in the Source Editor I performed a few simple actions like typing “sout” and pressing Tab to activate the code template. I then manually typed System.out.println and after EACH period allowed the code completion window to appear, paused for a few seconds, and select the “out”, and then the “println”.

Current memory status : 56 / 74.9 MB

So far, not bad. Forcing a garbage collection by clicking the memory window causes the memory to go down.

Current memory status : 32 / 75 MB

Now it is time to get serious…

I go to the main menu and select Profile >> Attach Profiler. The Attach Profiler window opens with the Attach To dropdown set to .

In the External Application settings, select “Application” from the Target Type dropdown field. I set the Attach Method field to “Local” and the Attach Invocation field to “Dynamic (JDK 1.6)”.

Continue to click Next until the wizard has finished and you are back at the Attach Profiler window. Start the Profiler by clicking the Attach button.

The Select Process window will appear as shown in Figure 1. This window allows you to select a process ID (PID) from the dropdown. The process details will be displayed. Click the OK button.


Figure 1

The Profiler will load and attach to the specified process which in this case is NetBeans 6 itself. One thing that worries me is what ahppens during this process… My computer memory usage (reported via Windows Task Manager) jumps 300 MB and my CPU usage spikes to 100%. This remained so for a shocking 2 full minutes. NetBeans stayed “locked up” like this the entire 2 minutes.

Finally, NetBeans loosened up and the Profiling session continued. I opened the VM Telemetry overview and just sat and watched.

Review the image below in Figure 2. Where Arrow #1 points was where I manually clicked the garbage collection window after the 2 minutes of “freeze”. Interestingly enough, the span between the two arrows referenced by #2 was when I sat with NetBeans 6 Beta open doing absolutely nothing (no clicking, no menus, no window opens, etc.). At arrow #3 I ran the file that was open in the Source Editor (which looped ten times printing “hi” to the standard output stream.


Figure 2

I performed a number of actions such as debugging a class, refactoring and renaming some class variables, oepning a number of windows, navigating menus, etc.

Current memory status : 75 / 180 MB allocated

As a final test, I opened 4 additional projects (2 very small Java Application projects and 2 small Java Web projects). By “small” I mean only a few JSP pages and 3-5 Java classes per project.

Current memory status : 120.2 / 180.4 MB allocated

Summary : Overall, the performance of NetBeans 6 Beta is pretty good considering I am running it on a single-core, single-processor laptop. The disappointment came when trying to dynamically attach the Profiler to itself. Other than that the Profiler reported very good numbers during my usage of the IDE for common tasks, menuing, windowing, etc. When the Profiler is not dynamically attached to the same NetBeans instance that is running it, the performance and memory usage is even better.

In general I have used NetBeans 6 Beta for several days of real work, editing numerous Java source files, both large and small. The performance in the Source Editor has improved significantly since NetBeans 5.5 The re-work to the underlying architecture of the NetBeans 6 editor definitely shows. Code completion is faster, variable highlighting is faster, and the overall responsiveness works better than ever before.

Side Note : On an interesting side note, I wanted to know how this compares to a full release of the Eclipse IDE. I downloaded Eclipse 3.3 Europa release with J2EE support and opened it using the same JDK version as I did with NetBeans (Sun JDK 1.6.0_02).

Windows Task Manager reports eclipse.exe using 74 MB of memory usage right off the bat (as opposed to NetBeans starting up with ~32 MB).

Finally, I opened an empty Dynamic Web Project, used the New File wizard to create a Java Class, and added an empty main method. To my surprise, the Windows Task Manager now reports eclipse.exe using 176564K (or about 176 MB). This is simply opening the IDE and viewing one Java source file.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>