# Improving Compilation Time of C/C++ Projects | Interrupt

**URL:** <https://community.memfault.com/t/improving-compilation-time-of-c-c-projects-interrupt/141>\
**Category:** Blog\
**Created:** [February 12, 2020, 5:51am UTC](https://community.memfault.com/t/improving-compilation-time-of-c-c-projects-interrupt/141 "2020-02-12T05:51:03Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![discobot](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.memfault.com/discobot/32/1_2.png) [@discobot](https://community.memfault.com/u/discobot)\
**Post date:** [February 12, 2020, 5:51am UTC](https://community.memfault.com/t/improving-compilation-time-of-c-c-projects-interrupt/141/1 "2020-02-12T05:51:03Z")

</div>

We’ve all likely worked on a software or firmware project where the build takes a “coffee break” amount of time to complete. It’s become such a common occurrence that there is an infamous [xkcd comic](https://xkcd.com/303/) related to the matter.

* * *
This is a companion discussion topic for the original entry at [https://interrupt.memfault.com/blog/improving-compilation-times-c-cpp-projects](https://interrupt.memfault.com/blog/improving-compilation-times-c-cpp-projects)

---

<div class="post-metadata">

**Author:** ![oschonrock](https://avatars.discourse-cdn.com/v4/letter/o/f6c823/32.png) [@oschonrock](https://community.memfault.com/u/oschonrock)\
**Post date:** [February 13, 2020, 9:39am UTC](https://community.memfault.com/t/improving-compilation-time-of-c-c-projects-interrupt/141/2 "2020-02-13T09:39:47Z")

</div>

Nice.  
Small tweak:  
`find . -name "*.i" | xargs wc -l | sort -r`

should probably be:  
`find . -name "*.i" | xargs wc -l | sort -rn`

Note the `-n`

---

<div class="post-metadata">

**Author:** ![mbitsnbites](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.memfault.com/mbitsnbites/32/37_2.png) [@mbitsnbites](https://community.memfault.com/u/mbitsnbites)\
**Post date:** [February 13, 2020, 4:34pm UTC](https://community.memfault.com/t/improving-compilation-time-of-c-c-projects-interrupt/141/3 "2020-02-13T16:34:27Z")

</div>

Regarding developer hardware: These days I see no reason to settle for anything less than 8 cores (actually, machines with 8 cores are labeled “slow” in our CI system).

---

<div class="post-metadata">

**Author:** ![tyler](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.memfault.com/tyler/32/18_2.png) [@tyler](https://community.memfault.com/u/tyler)\
**Post date:** [February 13, 2020, 5:43pm UTC](https://community.memfault.com/t/improving-compilation-time-of-c-c-projects-interrupt/141/4 "2020-02-13T17:43:27Z")

</div>

> [@oschonrock](#):
>
> Nice.  
> Small tweak:  
> `find . -name "*.i" | xargs wc -l | sort -r`
> 
> should probably be:  
> `find . -name "*.i" | xargs wc -l | sort -rn`
> 
> Note the `-n`

Good catch. Will make an edit. Thanks!

---

<div class="post-metadata">

**Author:** ![asu](https://avatars.discourse-cdn.com/v4/letter/a/d78d45/32.png) [@asu](https://community.memfault.com/u/asu)\
**Post date:** [February 16, 2020, 12:14pm UTC](https://community.memfault.com/t/improving-compilation-time-of-c-c-projects-interrupt/141/5 "2020-02-16T12:14:25Z")

</div>

Clang has a `-ftime-trace` option that is really handy for this. It generates dumps that can be read by Chrom{e,ium}'s `about:tracing`.

---

<div class="post-metadata">

**Author:** ![tyler](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.memfault.com/tyler/32/18_2.png) [@tyler](https://community.memfault.com/u/tyler)\
**Post date:** [February 17, 2020, 9:22pm UTC](https://community.memfault.com/t/improving-compilation-time-of-c-c-projects-interrupt/141/6 "2020-02-17T21:22:52Z")

</div>

> [@asu](#):
>
> Clang has a `-ftime-trace` option that is really handy for this. It generates dumps that can be read by Chrom{e,ium}'s `about:tracing` .

That’s really cool! After some searching around, it looks like there is also some work underway to do the same for GCC. [92396 – -ftime-trace support](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92396)

---

<div class="post-metadata">

**Author:** ![Hach](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.memfault.com/hach/32/215_2.png) [@Hach](https://community.memfault.com/u/Hach)\
**Post date:** [October 26, 2022, 3:59pm UTC](https://community.memfault.com/t/improving-compilation-time-of-c-c-projects-interrupt/141/7 "2022-10-26T15:59:55Z")

</div>

Is it possible to compile 1gb file with gcc with system ram 4g in a day

---

<div class="post-metadata">

**Author:** ![francois](https://avatars.discourse-cdn.com/v4/letter/f/77aa72/32.png) [@francois](https://community.memfault.com/u/francois)\
**Post date:** [October 27, 2022, 12:52am UTC](https://community.memfault.com/t/improving-compilation-time-of-c-c-projects-interrupt/141/8 "2022-10-27T00:52:04Z")

</div>

I don’t see why not. What is your concern?
