NetBeans Startup Performance Tips



Daniel re-opened the IDE startup speed topic. This has been a pet peeve of mine for some time when I used to have a slow computer - now I have fast one so I'm not really busy with it anymore. Anyway, I was thinking what a NetBeans user can do to improve it. I believe the performance guys are doing a good job by keeping an eye on performance and coding practices in general - it's sometimes interesting to observe the battles with developers who are writing low-performing code.

Daniel reported a very slow startup - for measurement he uses a so called pancake test. If he can make a pancake during IDE startup, there's something wrong.

We've exchanged some ideas how to improve the startup speed:
  • Check if the antivirus is not insanely checking all the IDE's classes (some of them may be so clever to unpack jars and run heuristic analysis on them).
  • Try to put the IDE on a faster hardrive if you have two.
  • Don't run NetBeans from the network (might be obvious, but you know...).
  • Try to turn off unnecessary modules - this actually really helps, I write more about it below.
  • Upgrade graphics card drivers, might work for somebody.
The result is that the pancake test passes now for Daniel (I hope he won't starve due to me ;-). Eclipse has a fast startup - might be a point for someone, but we should not forget that Eclipse by default doesn't contain all the J2EE, web services and other modules which are available in NetBeans out of box.

Improving startup speed by disabling unecessary modules (it works!)

All the new J2EE and web services modules added into NetBeans offer great functionality, but they also have some influence on the startup time. I can imagine there's a lot of developers who are using NetBeans just for J2SE, so they don't need all the J2EE, web applications, web services and databases support. Let's suppose they don't use versioning (not a very good practice, but it happens). I've tried to turn off these modules in Tools | Options | IDE Configuration | System | Modules:
  • Everything from J2EE - can be disabled as a whole category
  • Everything from Database - can be disabled as a whole category
  • Everything from Web except Web Browser Ant Task (required by J2SE) - modules need to be disabled individually
  • Everything from XML except XML Entity Catalog (required by J2SE) - modules need to be disabled individually
  • Everything from Version Control
  • All other dependend modules which the IDE asked me to disable
Please note that the IDE with various modules disabled cannot be tested (there are too many combinations), so do it with caution.

I have a much lighter version of NetBeans now and I got the following improvements on startup:

First startup - all modules: 45 s
First startup - NetBeans lite: 34 s

Consecutive startup - all modules: 11 s
Consecutive startup - NetBeans lite: 9 s

The difference is visible mainly during first startup - I've measured it right after reboot to avoid influences of the OS. It was measured on my home Athlon which runs at 1.16 Ghz (I wonder why it's called 2800+), 512 MB RAM, Windows XP and a relatively slow harddrive. I didn't have any project open, I've measured just the startup. Except for the module tweaking I used a default configuration. As I wrote in one of my comments I can get the IDE startup with all modules to 8 secs on my AMD 64bit notebook, it also seems to have a faster harddrive.

Harddrive speed seems to be very important, because the first startup reads everything - mention the huge difference between first and second startup. It's caused by reading all the files from cache during the second start.

If you have any additional ideas, please share them with us through comments.

Update: I've also tried to turn off the antivirus. What a difference:

First startup - all modules, with antivirus: 45 s
First startup - NetBeans lite, with antivirus: 34 s
First startup - all modules, without antivirus: 30 s
First startup - NetBeans lite, without antivirus: 21 s

So I was able to reduce the first startup time from original 45 seconds to 21 seconds just by disabling some of the modules and antivirus real-time scanning. The consecutive startup don't seem to be an issue at all.

Update 2: It's possible to set in many antivirus softwares filters which exclude files or directories from scanning. This can solve the issue with antivirus while remaining secure.

Update 3: If you will try to disable modules it's probably a good idea to keep two from Version Control: the CVS Support Profile and VCS Generic Command-line Support. For the rest the lite configuration (no J2EE, almost no web, no databases, almost no XML and CVS only versioning) seems to be stable. If you will try it and encounter any exceptions let me know.
Comments:

Yep it works :) but I must WARN: that if you disable too much you can run into trouble and end up with a java.lang.NullPointerException from the IDE. I just submitted a issue about this.

One thing that disappointed me was the way the IDE deals with Unexpected Exception; the Dialog window could have a Hyperlink to an email program/webpage that simply submits this to the issues page. Or at the very least a hyperlink or button that start the web browser, ctrl-c, shift-insert is not COOL.

Posted by Daniel MD on květen 20, 2005 at 07:22 dop. CEST #

Yes, as I wrote, all the combinations cannot be tested, we would not be doing anything else. So use it with caution. I also wish the bug submitting process was easier - as I am submitting bugs daily.

Posted by Roman Strobl on květen 20, 2005 at 07:29 dop. CEST #

I did not notice your warning, sorry for the repetition, i am a visual reader(i read really fast, with no vocalization, sometimes i read to fast and my brain does not have time to decode the image :-)

Now about the bug system, does the IDE have the Mozilla engine incorporated? If it did it would be really easy to parse the errors and create an automatic issue submitter

It would also allow for something that I think would be really cool, layered comments

. The idea is that instead of having the comment on the code we have an html layer that supports flash animation/whiteboard drawing and some simple syntax highlighting, bold, italic, paragraph. Imagine having an animated drawing of a communication process, or of a data structure, it would be very cool, you simply turn the layer on, or off just like Photoshop layers, it would be sweet.

Posted by Daniel MD on květen 20, 2005 at 08:12 dop. CEST #

No problem, I've changed the warning text to italic. No, unfortunately Mozilla engine is not incorporated. Layered comments seem to me as a good idea, although in my opinion this is more "nice to have" than a "must have" feature. If you really like it you can file it into Issuezilla.

Posted by Roman Strobl on květen 20, 2005 at 08:22 dop. CEST #

...just trying to stop the bold text you've started :-)

Posted by Roman Strobl on květen 20, 2005 at 08:25 dop. CEST #

I think what you say here is very true: "Eclipse has a fast startup - might be a point for someone, but we should not forget that Eclipse by default doesn't contain all the J2EE, web services and other modules which are available in NetBeans out of box."

People shouldn't ONLY compare startup time, but also WHAT is started up. Since NetBeans offers MORE than Eclipse by default (i.e., lots of J2EE-related stuff), it shouldn't be a surprise if startup time might take longer.

Posted by Geertjan on květen 20, 2005 at 09:10 dop. CEST #

Geertjan, exactly, that was my point.

Posted by Roman Strobl on květen 20, 2005 at 09:16 dop. CEST #

Another idea to warm-up the IDE startup is to lazy load the modules when it is needed, like the GUI Editing. This could be an option on IDE. Anyway is a great tool. I have tested/used Netbeans since 2.2 (1999), until now, I have used other IDEs (Idea, and JBuilder). Now Netbeans rocks and rocks very cool. My friend are amazing about the hotswap of classes (debugging) and mobility pack. Thanks!

Posted by Claudio Miranda on květen 20, 2005 at 09:29 odp. CEST #

Claudio, a good point. See our discussion with Daniel here - it's always a tradeoff. So I was rather looking for what a user can do to improve the startup, the antivirus seems to be a big issue, but not really discussed yet. I leave improving the internal NetBeans performance on proffessionals ;-) Btw, I've heard the Java and NetBeans community in Brazil is quite impressive, thanks for supporting us, you've chosen the bright side of the force!

Posted by Roman Strobl on květen 21, 2005 at 04:27 dop. CEST #

Hi Roumen,
This is what I did a while back (based on NB4.0):
NetBeans on a diet, take 1
NetBeans on a diet, take 2

Just curious, how are you measuring startup time? cheers,
-Alexis

Posted by Alexis MP on květen 23, 2005 at 03:42 dop. CEST #

Hi, nice, I can see you took it a bit more professional (by counting number of classes and memory usage) :-) I've used a stop watch to measure the startup time. I could have used the performance tests, but I was just too lazy to do so. I didn't need the exact times anyway - the difference is so huge it's enough to have measurements in orders of seconds. The measurement was taken from the click on the icon till the IDE screen is maximalized.

Posted by Roman Strobl on květen 23, 2005 at 04:21 dop. CEST #

Yeah sorry for the bold text, the comments layer is really a "nice to have, would be cool" very low priority thing. It looks to me that the Netbeans team has more interesting features to do, than this feature, but it would be cool.

I now have another approach to the whole start-up time issue. I simply tax it on the system start-up (i let Netbeans load with windows, and stay on the background), this way i don't get so frustrated. Instead of having OS+Netbeans load time I put it all together and have a simple system load time.

It simply improves responsiveness (it improves productivity, not system performance), maybe they could put this in the Netbeans installer has an option for the 4.2 version. There is the perception of improved performance, and not performance in itself, witch is a cool thing of the human psyche

Posted by Daniel MD on květen 24, 2005 at 06:19 dop. CEST #

I need help with Netbeans5.5. I can do a few things but I can't figure out how to: 1. Import a .form from another project without using cut and paste of the code and renaming an old project. 2.Plot within a Jform on canvas or a panel. I really need a simple example how to plot on a gui. 3. Use an old swing example with all the code all written in a netbeans project. Please help me.. how do I import this example? /\* \* Copyright (c) 2000 David Flanagan. All rights reserved. \* This code is from the book Java Examples in a Nutshell, 2nd Edition. \* It is provided AS-IS, WITHOUT ANY WARRANTY either expressed or implied. \* You may study, use, and modify it for any non-commercial purpose. \* You may distribute it non-commercially as long as you retain this notice. \* For a commercial use license, or to purchase the book (recommended), \* visit http://www.davidflanagan.com/javaexamples2. \*/ import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.BasicStroke; import java.awt.Color; import java.awt.Font; import java.awt.GradientPaint; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.RenderingHints; import java.awt.geom.AffineTransform; import java.awt.image.BufferedImage; import javax.swing.JFrame; import javax.swing.JPanel; /\*\* A demonstration of anti-aliasing \*/ public class AntiAlias extends JPanel{ static final int WIDTH = 650, HEIGHT = 350; // Size of our example public String getName() { return "AntiAliasing"; } public int getWidth() { return WIDTH; } public int getHeight() { return HEIGHT; } /\*\* Draw the example \*/ public void paint(Graphics g1) { Graphics2D g = (Graphics2D) g1; BufferedImage image = // Create an off-screen image new BufferedImage(65, 35, BufferedImage.TYPE_INT_RGB); Graphics2D ig = image.createGraphics(); // Get its Graphics for drawing // Set the background to a gradient fill. The varying color of // the background helps to demonstrate the anti-aliasing effect ig.setPaint(new GradientPaint(0, 0, Color.black, 65, 35, Color.white)); ig.fillRect(0, 0, 65, 35); // Set drawing attributes for the foreground. // Most importantly, turn on anti-aliasing. ig.setStroke(new BasicStroke(2.0f)); // 2-pixel lines ig.setFont(new Font("Serif", Font.BOLD, 18)); // 18-point font ig.setRenderingHint(RenderingHints.KEY_ANTIALIASING, // Anti-alias! RenderingHints.VALUE_ANTIALIAS_ON); // Now draw pure blue text and a pure red oval ig.setColor(Color.blue); ig.drawString("Java", 9, 22); ig.setColor(Color.red); ig.drawOval(1, 1, 62, 32); // Finally, scale the image by a factor of 10 and display it // in the window. This will allow us to see the anti-aliased pixels g.drawImage(image, AffineTransform.getScaleInstance(10, 10), this); // Draw the image one more time at its original size, for comparison g.drawImage(image, 0, 0, this); } public static void main(String[] a) { JFrame f = new JFrame(); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); f.setContentPane(new AntiAlias()); f.setSize(400,400); f.setVisible(true); } }

Posted by Shawn M. Kennedy on srpen 07, 2006 at 01:38 dop. CEST #

Post a Comment:
Comments are closed for this entry.
About

Roman Strobl

Search

Archives
« duben 2014
PoÚtStČtSoNe
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
    
       
Today