cargo-zigbuild icon indicating copy to clipboard operation
cargo-zigbuild copied to clipboard

Improve cargo-zigbuild zig performance

Open breezewish opened this issue 1 year ago • 3 comments
trafficstars

I recently discovered my C++ projects builds notably slower when using cargo-zigbuild, compared with a cmake toolchain I craft manually similar to https://github.com/mrexodia/zig-cross

After some debugging, I found that the initial process of fn execute_compiler (everything before actual zig Command::run) takes heavy amout of time, almost equal to the Command::run itself:

image

It would be great if the initial time could be reduced. Thanks!

breezewish avatar Apr 21 '24 14:04 breezewish

Maybe we can cache some of the repeated works.

messense avatar Apr 22 '24 08:04 messense

I guess most cost comes from spawning the Rust and Zig to checkout their versions. The versions could be checked when zigbuild is invoked and stored in zigcc-xx.sh.

breezewish avatar Apr 23 '24 04:04 breezewish