←back to thread

302 points Bogdanp | 4 comments | | HN request time: 0.904s | source
Show context
AndyKelley ◴[] No.44390865[source]
My homepage takes 73ms to rebuild: 17ms to recompile the static site generator, then 56ms to run it.

    andy@bark ~/d/andrewkelley.me (master)> zig build --watch -fincremental
    Build Summary: 3/3 steps succeeded
    install success
    └─ run exe compile success 57ms MaxRSS:3M
       └─ compile exe compile Debug native success 331ms
    Build Summary: 3/3 steps succeeded
    install success
    └─ run exe compile success 56ms MaxRSS:3M
       └─ compile exe compile Debug native success 17ms
    watching 75 directories, 1 processes
replies(8): >>44390894 #>>44390942 #>>44390948 #>>44391020 #>>44391060 #>>44391265 #>>44391881 #>>44393741 #
taylorallred ◴[] No.44390942[source]
@AndyKelley I'm super curious what you think the main factors are that make languages like Zig super fast at compiling where languages like Rust and Swift are quite slow. What's the key difference?
replies(4): >>44390972 #>>44391002 #>>44391022 #>>44396531 #
coolsunglasses ◴[] No.44391002[source]
I'm also curious because I've (recently) compiled more or less identical programs in Zig and Rust and they took the same amount of time to compile. I'm guessing people are just making Zig programs with less code and fewer dependencies and not really comparing apples to apples.
replies(1): >>44391520 #
kristoff_it ◴[] No.44391520[source]
Zig is starting to migrate to custom backends for debug builds (instead of using LLVM) plus incremental compilation.

All Zig code is built in a single compilation unit and everything is compiled from scratch every time you change something, including all dependencies and all the parts of the stdlib that you use in your project.

So you've been comparing Zig rebuilds that do all the work every time with Rust rebuilds that cache all dependencies.

Once incremental is fully released you will see instant rebuilds.

replies(2): >>44392395 #>>44431250 #
1. metaltyphoon ◴[] No.44392395[source]
When does this land in Zig? Will aarch64 be supported?
replies(1): >>44392786 #
2. mlugg ◴[] No.44392786[source]
When targeting x86_64, the self-hosted backend is already enabled by default on the latest builds of Zig (when compiling in Debug mode). The self-hosted aarch64 backend currently isn't generally usable (so we still default to LLVM when targeting aarch64), but it's likely to be the next ISA we focus on codegen for.
replies(1): >>44392895 #
3. metaltyphoon ◴[] No.44392895[source]
I assume x86_64 is Linux only correct?
replies(1): >>44393350 #
4. AndyKelley ◴[] No.44393350{3}[source]
Not quite- any ELF or MachO target is enabled by default already. Windows is waiting on some COFF linker bug fixes.