{"id":231,"date":"2008-11-15T10:19:05","date_gmt":"2008-11-15T08:19:05","guid":{"rendered":"http:\/\/www.netexpertise.eu\/en\/?p=231"},"modified":"2021-08-12T08:02:19","modified_gmt":"2021-08-12T06:02:19","slug":"speed-up-your-compile-time","status":"publish","type":"post","link":"http:\/\/www.netexpertise.eu\/en\/systems\/linux\/speed-up-your-compile-time.html","title":{"rendered":"Compile Twice as Fast with Make"},"content":{"rendered":"\n<p>Even though GNU &#8220;make&#8221; utility retrieves a lot of information off the system it&#8217;s running on, many times I have to wait a long time to get binaries compiled. It seems &#8220;make&#8221; doesn&#8217;t always pick the best settings to compile applications. I searched how I could speed up compilation times and here are some interesting results.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">build_server$ make\n5m7s<\/code><\/pre>\n\n\n\n<p><br>I wasn&#8217;t getting the best performances out of my <a href=\"\/en\/category\/systems\/linux\">Linux<\/a> Redhat, so I turned off the cpuspeed service. cpuspeed reduces or raises the clock speed basically to save power according to the <a href=\"https:\/\/linux.die.net\/man\/8\/cpuspeed\" target=\"_blank\" rel=\"noreferrer noopener\">man page<\/a>. This can have a significant impact when you need to release the CPU&#8217;s full capacity: 12% faster in my case:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">build_server$ \/etc\/init.d\/cpuspeed stop\nbuild_server$ make\n4m30s<\/code><\/pre>\n\n\n\n<p><br>Second setting you can play with is the number of jobs &#8220;make&#8221; can run simultaneously. This is particularly interesting when compiling on multicore servers, which is most likely the case nowadays. It looks like setting the jobs to the number of cores gives the best results with the -j command option. Number of cores can be obtained with the top or cat \/proc\/cpuinfo commands. This is another 48% gain, making it 53,7% overall.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">build_server$ make -j 4 # number of CPUs\n2m22s<\/code><\/pre>\n\n\n\n<p><br>CI\/CD is spreading fast and IT departments build and compile sometimes many times a day. It is crucial to reduce the time spent in compiling applications. These 2 tricks speed up compile times by over 50% which is pretty awesome. This test was conducted on compiling php on a Redhat distribution.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Even though GNU &#8220;make&#8221; utility retrieves a lot of information off the system it&#8217;s running on, many times I have to wait a long time to get binaries compiled. It seems &#8220;make&#8221; doesn&#8217;t always pick the best settings to compile applications. I searched how I could speed up compilation times and here are some interesting [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[425,11],"tags":[386,162,27,123],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.8.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Netexpertise - Compile Twice as Fast with Make<\/title>\n<meta name=\"description\" content=\"Try these 2 tricks to compile your applications twice as fast with &quot;make&quot; utility on multicore Linux servers\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/www.netexpertise.eu\/en\/systems\/linux\/speed-up-your-compile-time.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Netexpertise - Compile Twice as Fast with Make\" \/>\n<meta property=\"og:description\" content=\"Try these 2 tricks to compile your applications twice as fast with &quot;make&quot; utility on multicore Linux servers\" \/>\n<meta property=\"og:url\" content=\"http:\/\/www.netexpertise.eu\/en\/systems\/linux\/speed-up-your-compile-time.html\" \/>\n<meta property=\"og:site_name\" content=\"Netexpertise\" \/>\n<meta property=\"article:published_time\" content=\"2008-11-15T08:19:05+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-08-12T06:02:19+00:00\" \/>\n<meta name=\"author\" content=\"dave\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@netexpertise\" \/>\n<meta name=\"twitter:site\" content=\"@netexpertise\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"http:\/\/www.netexpertise.eu\/en\/systems\/linux\/speed-up-your-compile-time.html\",\"url\":\"http:\/\/www.netexpertise.eu\/en\/systems\/linux\/speed-up-your-compile-time.html\",\"name\":\"Netexpertise - Compile Twice as Fast with Make\",\"isPartOf\":{\"@id\":\"http:\/\/www.netexpertise.eu\/en\/#website\"},\"datePublished\":\"2008-11-15T08:19:05+00:00\",\"dateModified\":\"2021-08-12T06:02:19+00:00\",\"author\":{\"@id\":\"http:\/\/www.netexpertise.eu\/en\/#\/schema\/person\/cb4cd666549d22e9070ec1cfc1a496fa\"},\"description\":\"Try these 2 tricks to compile your applications twice as fast with \\\"make\\\" utility on multicore Linux servers\",\"breadcrumb\":{\"@id\":\"http:\/\/www.netexpertise.eu\/en\/systems\/linux\/speed-up-your-compile-time.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/www.netexpertise.eu\/en\/systems\/linux\/speed-up-your-compile-time.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/www.netexpertise.eu\/en\/systems\/linux\/speed-up-your-compile-time.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\/\/www.netexpertise.eu\/en\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Compile Twice as Fast with Make\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/www.netexpertise.eu\/en\/#website\",\"url\":\"http:\/\/www.netexpertise.eu\/en\/\",\"name\":\"Netexpertise\",\"description\":\"Systems \/ Networks \/ DevOps\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/www.netexpertise.eu\/en\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"http:\/\/www.netexpertise.eu\/en\/#\/schema\/person\/cb4cd666549d22e9070ec1cfc1a496fa\",\"name\":\"dave\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/www.netexpertise.eu\/en\/#\/schema\/person\/image\/\",\"url\":\"http:\/\/1.gravatar.com\/avatar\/1129916e1f4955bd632f27f836f64e55?s=96&d=mm&r=g\",\"contentUrl\":\"http:\/\/1.gravatar.com\/avatar\/1129916e1f4955bd632f27f836f64e55?s=96&d=mm&r=g\",\"caption\":\"dave\"},\"sameAs\":[\"http:\/\/www.netexpertise.eu\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Netexpertise - Compile Twice as Fast with Make","description":"Try these 2 tricks to compile your applications twice as fast with \"make\" utility on multicore Linux servers","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/www.netexpertise.eu\/en\/systems\/linux\/speed-up-your-compile-time.html","og_locale":"en_US","og_type":"article","og_title":"Netexpertise - Compile Twice as Fast with Make","og_description":"Try these 2 tricks to compile your applications twice as fast with \"make\" utility on multicore Linux servers","og_url":"http:\/\/www.netexpertise.eu\/en\/systems\/linux\/speed-up-your-compile-time.html","og_site_name":"Netexpertise","article_published_time":"2008-11-15T08:19:05+00:00","article_modified_time":"2021-08-12T06:02:19+00:00","author":"dave","twitter_card":"summary_large_image","twitter_creator":"@netexpertise","twitter_site":"@netexpertise","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"http:\/\/www.netexpertise.eu\/en\/systems\/linux\/speed-up-your-compile-time.html","url":"http:\/\/www.netexpertise.eu\/en\/systems\/linux\/speed-up-your-compile-time.html","name":"Netexpertise - Compile Twice as Fast with Make","isPartOf":{"@id":"http:\/\/www.netexpertise.eu\/en\/#website"},"datePublished":"2008-11-15T08:19:05+00:00","dateModified":"2021-08-12T06:02:19+00:00","author":{"@id":"http:\/\/www.netexpertise.eu\/en\/#\/schema\/person\/cb4cd666549d22e9070ec1cfc1a496fa"},"description":"Try these 2 tricks to compile your applications twice as fast with \"make\" utility on multicore Linux servers","breadcrumb":{"@id":"http:\/\/www.netexpertise.eu\/en\/systems\/linux\/speed-up-your-compile-time.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["http:\/\/www.netexpertise.eu\/en\/systems\/linux\/speed-up-your-compile-time.html"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/www.netexpertise.eu\/en\/systems\/linux\/speed-up-your-compile-time.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/www.netexpertise.eu\/en"},{"@type":"ListItem","position":2,"name":"Compile Twice as Fast with Make"}]},{"@type":"WebSite","@id":"http:\/\/www.netexpertise.eu\/en\/#website","url":"http:\/\/www.netexpertise.eu\/en\/","name":"Netexpertise","description":"Systems \/ Networks \/ DevOps","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/www.netexpertise.eu\/en\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"http:\/\/www.netexpertise.eu\/en\/#\/schema\/person\/cb4cd666549d22e9070ec1cfc1a496fa","name":"dave","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/www.netexpertise.eu\/en\/#\/schema\/person\/image\/","url":"http:\/\/1.gravatar.com\/avatar\/1129916e1f4955bd632f27f836f64e55?s=96&d=mm&r=g","contentUrl":"http:\/\/1.gravatar.com\/avatar\/1129916e1f4955bd632f27f836f64e55?s=96&d=mm&r=g","caption":"dave"},"sameAs":["http:\/\/www.netexpertise.eu"]}]}},"_links":{"self":[{"href":"http:\/\/www.netexpertise.eu\/en\/wp-json\/wp\/v2\/posts\/231"}],"collection":[{"href":"http:\/\/www.netexpertise.eu\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.netexpertise.eu\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.netexpertise.eu\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.netexpertise.eu\/en\/wp-json\/wp\/v2\/comments?post=231"}],"version-history":[{"count":0,"href":"http:\/\/www.netexpertise.eu\/en\/wp-json\/wp\/v2\/posts\/231\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.netexpertise.eu\/en\/wp-json\/wp\/v2\/media?parent=231"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.netexpertise.eu\/en\/wp-json\/wp\/v2\/categories?post=231"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.netexpertise.eu\/en\/wp-json\/wp\/v2\/tags?post=231"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}