Software Woes

Rants, tips and tricks

Wednesday, June 06, 2007

Slow compiling? Check your memory

Today I got completely frustrated with GCC. I was doing some coding on FlameRobin, changing just a single file. Save, run make - it takes 1.5 minutes or something for thing to get compiled and linked so I can test it. I have a 1.6GHz CPU with 512 MB of RAM. Now, how could it be that slow. But, one thing caught my eye: while linking the hard disk would work like crazy. I looked and there was no swap usage, but RAM was used 99%. No swapping, but obviously it had to release stuff from the cache and load it back in.

Time for testing

I deleted the executable and ran 'make' again. It took 55 seconds. Too much. Ok, I closed down the browser, music player, even text editor. New run: 43 seconds. Not good enough.

At this point I decided to kill the beast. I shut down KDE, went back to console and installed IceWM. Got back to X, installed SciTE to use it instead of Kate (perhaps I should learn Emacs one of these days). Launched Mozilla to blog about this and xmms instead of JuK. Run the experiment again:

milanb@asus:~/devel/svn/flamerobin/rel-gtk2-wx280$ time -p make
g++ -o flamerobin flamerobin_addconstrainthandler.o flamerobin_Config.o
real 10.90
user 8.45
sys 2.07


Well, quite enough reason for me to go back to IceWM, at least while developing in C++. Ok, now the real problem is Workrave which (from reasons yet unknown) loads kdeinit and two more KDE deamons with it.

Perhaps I should just get 2GB of RAM and forget about the whole problem? Only thing bothering me is that this machine is a notebook, so it isn't so easy to upgrade.