News for hackers. Stuff that matters.
Re:Minimal x86 Kernel Zig by pmarreck on Wednesday February 18, 2026 @01:12AM (#47057772)
because Zig is simply a better C, often faster (normally at least as fast), but with way more safety guarantees or at least things preventing the vast majority of traditional C footguns from happening
Re:Minimal x86 Kernel Zig by bjourne on Wednesday February 18, 2026 @03:48AM (#47058784)
Zig is not faster than C.
Re:Minimal x86 Kernel Zig by lionkor on Wednesday February 18, 2026 @06:05AM (#47059759)
Would you say its always slower, or always faster?
Re:Minimal x86 Kernel Zig by flohofwoe on Wednesday February 18, 2026 @06:12AM (#47059797)
The optimization work happens in the LLVM backend, so in most cases (and using the same optimization and target settings - which is an important detail, because by default Zig uses more aggressive optimization options than Clang), similar Zig and C code translates to the exact same machine code (when using Clang to build the C code).

The same should be true for any compiled language sitting on top of LLVM btw, not just C vs Zig.

Re:Minimal x86 Kernel Zig by bjourne on Wednesday February 18, 2026 @09:22AM (#47061210)
No. I will continue my crusade against blanket statements about performance.
Re:Minimal x86 Kernel Zig by pmarreck on Wednesday February 18, 2026 @04:56PM (#47067003)
Gee, good thing I didn't make a blanket statement and qualified it by saying "often", which is true, my contrarian dude. https://tigerbeetle.com wouldn't have chosen it unless they found it faster than C- and there's a significant quantity of money riding on that decision, so it likely wasn't done lightly at all.

The rest, you can google yourself, but in short, sorry to tell you that it is sometimes faster. Often, sometimes, some portion of the time.

Re:Minimal x86 Kernel Zig by bjourne on Thursday February 19, 2026 @04:55AM (#47072019)
No. It is a blanket statement that is never true. A programming language has no inherent speed. Your appeal to authority argument is rejected.
Re:Minimal x86 Kernel Zig by lionkor on Thursday February 19, 2026 @04:22AM (#47071764)
That's what I was getting at in my response. Once you add the qualifiers that were originally implied, its obvious that this is not an objective discussion to be had.
Re:Minimal x86 Kernel Zig by flohofwoe on Wednesday February 18, 2026 @06:10AM (#47059786)
With default build settings it actually might be, because Zig's release mode builds with the equivalent of `-march=native` by default ;)

(disclaimer: not sure if that's actually still the case, last I checked in detail was probably 2 years ago).

Also Zig always builds the entire project as a single compilation unit, which allows more optimization options because the compiler sees all function bodies. The closest equivalent in the C world is LTO, but this is usually also not enabled by default.