#How to deal with huge compile times

13 messages · Page 1 of 1 (latest)

high tinsel
#

I have a project that is abound 300 lines in size but uses typst and iced as dependencies.

On my best machine it takes around 40-50 Seconds to compile. That makes development very tedious.
My machine runs Debian 12 and uses a Ryzen 5 2600x and 32GB DDR4 Ram.

How do I work on such projects and deal with the compile time?

mystic badge
#

Is that 40 seconds incremental?

high tinsel
mystic badge
#

Also could you do cargo build --timings and post the resulting graph?

high tinsel
high tinsel
high tinsel
rugged mango
#

in general you want to:

  1. have cargo watch -l -x "build" always run in another tmux pane
  2. use mold
  3. use sccache
  4. enable parallel frontend if you use nightly
rich dawn
high tinsel
rich dawn
#

Reading that data, looks like a lot of times that your CPU is not being used fully because there aren't enough things to compile

#

You might want to try splitting your binary into a couple libraries in order to get more compiling in parallel