Re:Zig Devlog: Self-Hosted x86 Back End Is Now Default in De...
by treeshateorcs on Sunday June 08, 2025 @07:14PM
(#44220088)
so, a helloworld program (`zig init`) is 9.3MB compiled. compared to `-Doptimize=ReleaseSmall` 7.6KB that is huge (more than 1000 times larger)
[ Parent
| on HN ]
Re:Zig Devlog: Self-Hosted x86 Back End Is Now Default in De...
by AndyKelley on Sunday June 08, 2025 @07:21PM
(#44220119)
Indeed, good observation. Another observation is that 82% of that is debug info.
-OReleaseSmall -fno-strip produces a 580K executable, while -ODebug -fstrip produces a 1.4M executable.
zig's x86 backend makes for a significantly better debugging experience with this zig-aware lldb fork: https://github.com/ziglang/zig/wiki/LLDB-for-Zig
I don't recall whether it supports stepping through comptime logic at the moment; that was something we discussed recently.
Re:Zig Devlog: Self-Hosted x86 Back End Is Now Default in De...
by treeshateorcs on Monday June 09, 2025 @02:02AM
(#44221765)
is it naive to expect the new backend to release -OReleaseSmall binaries as small as llvm in the future?
Re:Zig Devlog: Self-Hosted x86 Back End Is Now Default in De...
by squeek502 on Monday June 09, 2025 @02:23AM
(#44221856)
As far as I'm aware, using the self-hosted backend for anything other than Debug mode is a goal, but a far-future goal.
I believe the most relevant links are https://github.com/ziglang/zig/issues/16270 and https://github.com/orgs/ziglang/projects/2/views/1?pane=issu... (as you can see, nothing is concrete yet, just vague mentions of optimization passes)