Skip to main content

How to speed-up make-based building process

If you are building some multifile-based project using make tool, it is worth to use parallel build in order to speed up building process.

You can do that using -j option of make tool ex.

make -j2


If you will select -j2, you are informing your compiler to use 2 cores of your CPU for building process.

The optimal option is to split build using all cores of your CPU. In order to get number of cores of your CPU on Linux-based OS you can use command:

nproc

Therefore, if you would like to speed-up build time optimally using all cores of you CPU, you can use following command on Linux-based OS:


make -j`nproc`



Picture source: http://hostme.ie/wp-content/uploads/2011/03/speed-up-wordpress.jpg

Comments

Popular posts from this blog

Blog's new layout

As you noticed this blog has new layout from today. I hope you like it. I think new layout looks better and more modern than previous one. Please, write you opinion about new layout in comments. If you have some ideas how to make this blog better, all ideas are welcomed. Enjoy new layout and blog articles.

GDB Automatic Deadlock Detector

Have you ever had a problem with detection deadlock between threads in your C/C++ application? Would you like to do that automatically? Try this GDB Automatic Deadlock Detector from my github: GDB Automatic Deadlock Detector Picture source: http://csunplugged.org/wp-content/uploads/2015/03/deadlock.jpg1286488735

C++11 - Right angle bracket

In C++03 " >> " is always interpreted as right shift operator . It causes problem for nested template declaration like here: In above example for C++03 we have compilation error because of unintended interpretation of " >> ". Compiler interpret it as right shift operator - not like two nested vectors. Proper syntax in above situation should include space character between two " > " characters closing nested templates like here: It it not very comfortable and sometimes causes problems with finding reason of compilation error. Fortunately, C++11 standard solves that problem. It implements proper interpretation of nested templates without space between two right angle operators " > ". Therfore in C++11 following syntax: is properly interprated as two nested vectors.