How to make faster

tux_compThe make tool can run jobs (commands) simultaneously instead to running them one by one. Works best on multiprocessor systems. To enable it, run:

$ make -j n

where n is the number of parallel jobs to execute. As per this analysis, the results are best when n = number of processors in the system.

This speeds up the compilation of large source code like that of the Linux kernel. As Bob has mentioned in his comment below, not all Makefiles are “job safe” and the jobs may be completed in any order. So be cautious when using the -j option.

2 thoughts on “How to make faster”

  1. a) Note well that -j can change the order things get built in, even if you use -j1. Not every Makefile is “jobs safe”
    b) There are larger pieces of software than the Linux kernel 😉

    1. a) That’s correct and duly noted. But it does take care that the whole dependency tree is completed in order in one job. Of course, doesn’t work for all Makefiles.

      b) The intention was to use an well known example. However, I still stand by what I have written – I do consider the independent kernel source large, it’s impossible to ignore the fact that it’s more than 15 million lines of code now. Of course I have worked on several smartphone models where the whole system, middleware and application code of the project sum up to many gigs, some even based on the kernel. But wouldn’t that be a vague example? Can you enlighten us with some other well-known example(s) that you actually have seen? That would be a welcome addition for the readers of this post :).

Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s