Compiling at the speed of light
By default the make command won't use more than one process to compile things. With a tiny bit of tweaking you can slice off precious minutes and save yourself a noticeable amount of time.
While most Linux users can get by perfectly well without compiling anything, I don't count myself amongst their ranks. If you play games through Wine or like to test the very latest Firefox has to offer, you need to download the source and compile things up for your system. The problem: this takes a damned long time.
Multi-core processors have been with us for some time now. I've had my X2 4800+ for almost 2 years now and I've been loving it. Most of the applications that are CPU intensive know how to take advantage of them and that's all great. Unfortunately make isn't one of them.
But make has a --jobs (-j) option, allowing you to fracture the compilation into several processes. It is recommended that you use n+1 jobs, where n is the number of cores your processor contains. I have 2 cores, so I run this:
make -j3
The performance gain is immense. Here are the times for one and two core (three "jobs") building, respectively:
real shows the actual time taken. user shows the amount of CPU time used. sys shows the time taken on related kernel processing.
So specifying the cores can save you about 43% of the total build time for Wine. I've tested this with other applications and the savings where all around 40%. If you have a quad-core, I'd love to see how much faster you can build it using -j5.
I've also looked at compiling from RAM. I created a 1gig RAMdisk using tmpfs, copied the source there and compiled with the -j3 option but this only gave an extra few seconds performance improvement. RAMdisks are massively faster for heavy I/O operations than mechanical disks, so the poor improvement shows that compilation (at least in Wine's case) bottlenecks on the CPU more than anywhere else.
Don't just sit there like a lemon! Reply!
Got something to say? Now's the time to share it with the author and everybody else that reads this posting! Lemons need not apply.