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.