top | item 47059759

(no title)

lionkor | 13 days ago

Would you say its always slower, or always faster?

discuss

order

flohofwoe|13 days ago

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.

bjourne|13 days ago

No. I will continue my crusade against blanket statements about performance.

pmarreck|12 days ago

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.

lionkor|12 days ago

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.