UPDATE: tweak Netbeans configuration file.
Yeah NB can be slow sometimes. If you have some spare RAM megabytes you can make use of this old trick. I remember using this same trick to speed up Quake execution on ms-dos
.
- Uninstall Netbeans
- sudo mkdir /media/ramdisk
- sudo mount -t tmpfs none /media/ramdisk
- Then install netbeans to /media/ramdisk
That’s all
Off course, you will need a decent amount of ram. Netbeans uses like 95mb of disk for version 6.0.1 (linux)
I found that tmpfs writes its contents to the directory it was mounted to once you unmount it, so it should persist its contents between system boots! I just needed to update /etc/fstab with this line: “tmpfs /media/ramdisk tmpfs”
For Windoze, you should google for ramdisk support. I can’t get precise measures on the gain in performance, but I found that installing NB to ram really speeds things up. Now I should try to install the whole ruby interpreter in my ramdisk ….
UPDATE:
Amit Kumar Saha pointed out that tmpfs does not keep its contents to the disk on reboot. He is right. I manually unmounted the ram disk an it _did_ keep its contents to the disk, so I thought it was going to keep the contents also when booting. But when I did boot my pc, it didn’t work the same. To work around this, I did a tar package of my installation:
- cd /media/ramdisk
- tar cvvzf /home/emmanuel/tar/nb601.tar.gz netbeans-6.0.1/
Then added this line to my /etc/rc.local:
- tar xvvzf /home/emmanuel/tar/nb601.tar.gz -C /media/ramdisk
That surely worked on reboot. Off course I will have to create the tar again everytime I change something in the ramdisk.

Amit Kumar Saha 5:45 am on Marzo 20, 2008 Permalink |
Hi!
I am Amit K. Saha and the NetBeans community docs co-ordinator. Your post could make an interesting read on the NetBeans community docs wiki at
http://wiki.netbeans.org/wiki/view/CommunityDocs
So please consider contributing this post to the wiki. Or if you are busy, I can do that for you.
Just drop me a mail at the address given above.
Thanks and I look forward to seeing your contribution.
Amit Kumar Saha 11:59 am on Marzo 20, 2008 Permalink |
It doesn;t seem to work
‘tmpfs’ *do not* preserve its contents. I created the ramdisk and wrote a simple file to it and after rebooting, it was gone!
I am using a 2.6 kernel, also read http://www.ibm.com/developerworks/library/l-fs3.html
Brian Mosher 3:31 pm on Abril 10, 2008 Permalink |
Have a look at the squash filesystem they are used by DSL, Knopixx, etc… you could rig up a seperate mount to use this and it will be read into memory on boot andretain it’s data after restart.
Scabrously 4:33 pm on Junio 19, 2008 Permalink |
Somehow i missed the point. Probably lost in translation
Anyway … nice blog to visit.
cheers, Scabrously
Alex 4:43 am on Noviembre 4, 2008 Permalink |
It’s worth noting that this will only help NetBeans load its files (jars, etc) faster, and then only if your operating system wouldn’t have had them in its disk cache already. If you have lots of spare memory and you run NB fairly often, it probably already does.
To demonstrate this, unmount the ramdisk you had NB on, then do the following:
1. Start NB.
2. Close NB.
3. Start NB again.
Unless memory is really tight on your machine, the second startup should be a lot quicker. The disk cache is the main reason for this.
If you use a ramdisk, you’re basically second-guessing your OS by forcibly preloading those files, even if they’re only rarely used or not used at all, and never allowing it to use the memory for something potentially more useful.
Of course, this can (and, in your tests, apparently does) still work out in your favor if you really do know better than whatever algorithms your OS uses to decide what to keep cached. Just remember that you’re making a trade-off between explicitly preloading what you know you need and caching what you don’t know you need.
On Linux, the command-line tool ’slabtop’ can be used to see what kind of items your kernel is caching, and in what proportions. I don’t know of any way to see which files are being cached, though.
An alternative to ramdisks might be to use some sort of adaptive preloading daemon, like preload or Windows Vista’s Superfetch. Unfortunately, in my experience, these produce no noticeable performance improvement. They also seem to actually hurt performance, apparently because they consume lots of memory and make the OS start swapping, which is much worse for performance than no preloading at all.