SVF icon indicating copy to clipboard operation
SVF copied to clipboard

build.sh: use ninja

Open gerion0 opened this issue 4 years ago • 3 comments

This has the main advantage that ninja uses all cores per default resulting in a faster compilation on machines with more or less than 4 cores.

See #302 for more discussion.

gerion0 avatar Aug 25 '20 13:08 gerion0

One concern with ninja for C++ projects is the high memory usage. For example, I have 8 GB of memory and 4 cores/8 threads on one of my machines and last I tried ninja, it using all available CPU caused the machine to halt from OOM. For make, I limit myself to j4 on that machine. Not sure if there is a way to limit meory given to ninja.

mbarbar avatar Feb 25 '21 23:02 mbarbar

-j4 reduces the memory only as a side effect. The option actually limits the number of parallel jobs to 4 at maximum. Ninja has the exact same option, so ninja -j4 should behave similar to make -j4. Maybe, it is a good idea to propagate this argument to the user? So build.sh e.g. uses all 32 cores by default (much faster given that enough RAM is available) but can be limited with build.sh -jX to use less cores.

gerion0 avatar Feb 26 '21 08:02 gerion0

I wasn't aware controlling jobs was possible in ninja. I guess I never checked? Thanks haha. I like the idea of giving build.sh an optional -j argument.

mbarbar avatar Feb 26 '21 09:02 mbarbar