Thursday, January 21, 2010

Compile software with make -j

In my previous blog post I explained how to install software on GNU/Linux using Fedora's yum installer and how to compile software.

My professor was telling us how when we compile software it will compile each line of the make file one at a time. This can be a bit of a hassle when installing software like Apache or other large applications. So I did a small benchmark testing to see how much of a difference it makes when you tell make that your cpu can handle more than one job at a time. This was tested on a Q6600 which means its a quad-core.

Compiling irssi-0.8.14

Make(without -j):

$ time make
$ real 0m11.364s
$ user 0m6.175s
$ sys 0m4.332s

Eleven seconds to compile the irc client. Not bad but let us see how it compares to make with the multi-job flag.

Make -j 5

$ time make -j5
$ real 0m3.819s
$ user 0m5.882s
$ sys 0m4.990s

Wow, took four seconds to compile. That makes a big difference.

When you have the horsepower, you may as well use it because it will save you time.

No comments:

Post a Comment