Threads allocated for "copy" targets

52 views
Skip to first unread message

Tekin Ozbek

unread,
Jul 7, 2023, 11:36:49 PM7/7/23
to ninja-build
If I am copying (hypothetically) 100,000 files from the source tree to the output directory, does ninja use one thread per file copied, or does it use one thread for the whole copy operation?

Thanks.
Tekin

Tekin Ozbek

unread,
Jul 8, 2023, 1:57:54 PM7/8/23
to ninja-build
Should have added the rule to the copy command...

rule copy
  command = cp ${in} ${out}

where in and out are individual files and not directories. So each copy target has one file copied. My guess is that ninja just allocates a different thread for each target, and it does not know about (or guess) CPU vs IO bound commands.

Evan Martin

unread,
Jul 8, 2023, 1:59:41 PM7/8/23
to Tekin Ozbek, ninja-build
Each task like “cp” is a process, and ninja executes processes in parallel based on the -j flag etc. it does not guess about what the commands do but you can provide hints via the “pool” syntax, see the manual for more. 

--
You received this message because you are subscribed to the Google Groups "ninja-build" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ninja-build...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ninja-build/87145b06-246a-47ee-a0ca-d508309b1544n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages