#faster compilation times

1 messages · Page 1 of 1 (latest)

fiery acorn
#

Is there any way of improving the compilation times for zig?

even after adding little changes to my code i have to wait 5-10s

    exe.linkLibC();
    exe.addIncludePath(b.path("src/vendors"));
    exe.addCSourceFiles(.{ .root = b.path("src/vendors"), .files = &.{"glad.c"} });
    exe.linkSystemLibrary("gl");
    exe.linkSystemLibrary("glfw");
oak fractal
#

Currently the best you can do is disable llvm. You can do that by setting .use_llvm = false and .use_lld = false in your .addExecutable options. Note you will get very few optimizations so this is for debug builds.

#

Incremental compilation is currently under way, so you could attempt to use that as well if you're on master. Idk its current state or where to find docs/examples though

fiery acorn
#

thanks. will try now

#

well..

#

it takes even longer 😬

#

it recompiles the code without even changing anything

tall cloak
#

it should absolutely not take longer in any scenario, are you maybe seeing the build script recompile after changing it?

#

also just like, dont compile it if nothing changed?

finite palm
#

I expect first time attempting incremental will build everything.

fiery acorn
#

after running it i am getting [_] steps

#

it does that even if i dont change anything

tall cloak
#

yes the backend doesnt integrate with caching yet

fiery acorn
#
.use_llvm = false,
.use_lld = false,
tall cloak
#

..?

fiery acorn
#

meant to be faster right?

tall cloak
#

yes

oak fractal
#

If you just edited the build.zig and ran zig build, you will see LLVM because it's building the build.zig. After that you should no longer see LLVM

fiery acorn
#

takes +10s longer

tall cloak
#

every single time?

fiery acorn
#

yes

#

after adding the above

empty turret
#

Are you on Windows? One time I had it be really slow because I was using a nightly Zig build and Windows Defender was being cautious about the executable

#

Here's an incremental build from a small change on my biggest project (quite a few dependencies). CPU is a i7-8700K, it's a hackintosh. Not using the new incremental compilation or anything fancy as far as I know. So 5-10s sounds off

fiery acorn
fiery acorn
#

nightly version

empty fjord
#

@fiery acorn not the answer you are looking for, but Andrew's main goal right now is to hammer on making the compiler as fast as possible to speed up development of the compiler itself, and everyone else's as a consequence. He talked about it in his 2024 roadmap/plans/goal presentation

fiery acorn
#

thats good

#

thats the main reason why i dislike rust

#

have to wait hours to compile single line

indigo crown
#

0.15 main focus is compiler speed afaik

#

0.14 I mean