Install -C is now my compile bottleneck

Ahahahahah ahah

But seriously, by a considerable margin.

So I have this dvui app that now compile instantaneously in incremental mode on zig master. But it is 260 Mo-ish and install -C .zig-cache/... takes 1.3 seconds on my laptop.

And yes, it feels very wrong :wink:

But if I try to run the install command without the -C flag, it takes only 0.2 [s] (same with cp)

So I’m gonna guess that the comparison of files introduced with -C, or the reading of destination, or likely both is responsible for the extra duration.

Is anybody familiar with that stuff from zig’s perspective ?

PS : I can obviously tweak the build script to not copy the file but this seems a bit hackish…

Ah, but wait. I had the feeling of this being new. I just manage to test on 0.17.0-dev.864+3deb86baf and the exact same source code doesn’t show this behavior.

i.e. install -C .zig-cache/.... is very fast.

So something changed in latest zig but I don’t get how this could influence the execution speed of install command …

Ok, sorry for the split message.

I know why it’s slower, the -fincremental results with a binary of 2.2G instead of 229M on 0.17.0-dev.1099+7db2ef610

a) I should have noticed this earlier, in which case I would have wait a couple of days to see if it’s a temporary regression

b) Since I already posted, is anybody aware of it ?

1 Like

So, I couldn’t find any issue on the official bug tracker that seems related (but there is a lot related to incremental, I’ll refrain myself to increase the noise there for a little bit more time)

In the mean time, I put together a minimal repro : https://codeberg.org/Yinameah/big_incremental_binaries_zig_repro

Oh, apologies for not noticing this thread earlier! Thanks for reporting this on the issue tracker. I commented on that issue, but will also note here: this should be fixed on the latest Zig compiler build on https://ziglang.org/download, so it’d be great if you could give that a try at some point!

1 Like

No worries. And you kind of did noticed since you fixed the issue :wink:

So, yes, happy to confirm that building with 0.17.0-dev.1413+addc3c3b8 does revert to ā€œnormal sizedā€ binary. Which puts me back on tracks for instant recompile. Yay !

Going to close the codeberg issue.
Thanks for taking the time to answer.

2 Likes