#More fine-grained tradeoff

1 messages · Page 1 of 1 (latest)

somber grove
#

The binary size are larger when the optimization mode is ReleaseFast and the performance loss is larger when it is ReleaseSmall. Is there any way to achieve a more fine-grained tradeoff?

olive atlas
#

ReleaseSmall is still pretty fast. Is there a specific thing youd want this tradeoff to do regarding codegen?

somber grove
#

I'm doing a benchmark of C vs. Zig.
When the optimization mode is ReleaseFast, the performance is slightly better than C, but the bin size of Zig is 748k, and that of C is 20k. But when the optimization mode is ReleaseSmall, the performance is significantly worse than that of C, and the bin size of Zig is 16k.

olive atlas
#

u cant really compare "languages" for speed because it all depends on whos writing in them. Regardless, make sure ur passing the right flags to C as well (-Oz -march=native for Small, -O3 -march=native for Fast). Zig's also doing a bit more than c though (regarding stack traces and the like, not using libc on linux by default) so makes sense that its bigger

somber grove
#

All right, thanks.

neat cloud
#

protty already touched on this above, but keep in mind that c is arguably cheating because you're probably dynamically linking to libc

#

this is also why c compilers seem way faster than the zig compiler for things like hello world but for big projects are potentially slower