KoblentsBlog Photography
Contact About
Make -j
Today I found out about the command make -j. You might be thinking: well yeah, if you specify make -j2 make will use two threads, and make -j4 will use four, what's interesting about that? That's the awesome part - you don't have to specify a paramater! The entire command is make -j with no parameter passed to j. In this instance, make simply uses all available threads!
A word of caution: This worked fine on my work machine. However, when it was tested on a home server-style machine (a headless box used for dev work) running an Ivy Bridge 3770K, with 16GB memory, the entire system locked up hard enough to require a hard reboot. This may be a one-time issue, but run this with care.
Output when compiling a small ~7k lines of code C++ program: (Please note this is before I found the time command, so I ran date twice in order to get the runtime of a command.)
> make clean
rm -rf objects/*.o
> date; make > /dev/null; date
Thu Jul 19 15:23:41 PDT 2012
Thu Jul 19 15:24:17 PDT 2012
> make clean
rm -rf objects/*.o
> date ; make -j > /dev/null ; date
Thu Jul 19 15:25:56 PDT 2012
Thu Jul 19 15:26:00 PDT 2012
Ches Koblents
July 18, 2012
« Newer Older »
© Copyright Koblents.com, 2012-2017