Why ninja build is much slower than make in my docker container?

1,245 views
Skip to first unread message

Xiang Yue

unread,
Sep 9, 2021, 5:31:45 AM9/9/21
to ninja-build
Hello,
I use CMake and ninja to build my project, however the build speed by ninja is much slower (about 3~5 times) than make. Meanwhile, I found 100% disk usage during ninja build. 

I build the target in a Centos docker container, and the ninja version is 1.10.2. The ninja.build file generated by CMake is attached in this session.

Is there anyone has a clue for this issue?

Best regards,
Yue Xiang
build.ninja

Olivier Croquette

unread,
Sep 9, 2021, 5:33:48 AM9/9/21
to ninja...@googlegroups.com
On 09/09/2021 11:31, Xiang Yue wrote:
I use CMake and ninja to build my project, however the build speed by ninja is much slower (about 3~5 times) than make. Meanwhile, I found 100% disk usage during ninja build.

Did you check if they are using the same number of jobs? You can control it on the command line with both tools.

If it is too high, it can cause a high I/O load and slower builds.

Olivier


Claus Klein

unread,
Sep 10, 2021, 2:31:21 PM9/10/21
to ninja-build

It does not help to share a generated build.ninja file!
Do you understand the file content?

Describe your project: build host, toolchain, memory, cpu, ...

Share you project git repo or try it on GitHub with action yourself.

ninja build with cmake are normally much faster than makefile based builds!

But it needs cpu cores, memory, disk IO performance, ... and its depend too on your project structure (dependency tree)!

Claus Klein

unread,
Sep 10, 2021, 2:35:49 PM9/10/21
to ninja-build
try this in your dogger container: https://github.com/ClausKlein/build-performance
Reply all
Reply to author
Forward
0 new messages