5 ms·
No-Libc Zig Now Outperforms Glibc Zig
- ggm 2y agoI just want to observe libc != glibc there have been and continue to be diverse libc. Maybe I missed if zig on BSD is faster without native non-gnu (possibly less or non-portable) libc. It may well be. They tested on asahi Linux.
- AndyKelley 2y agoHello! This is my devlog entry. I've been testing on Linux 6.12.3 AMD Ryzen 9 7950X 16-Core Processor, against this glibc: libc.so.6 => /nix/store/nqb2ns2d1lahnd5ncwmn6k84qfd7vx2k-glibc-2.40-36/lib/libc.so.6 (0x00007fb4dbd62000)
- ggm 2y agoMassively different syscall api in BSD so probably another mountain of work to do zig independent of bsd libc
- AndyKelley 2y agoI've been looking forward to doing that work, actually. Originally it was my impression that for instance FreeBSD required libc as the stable syscall ABI, however David Chisnall informed me that in fact, the syscall ABI is stable! That's great news as far as I'm concerned because it's quite handy for cross-compilation and static executable distribution.
- ggm 2y agoGreat! Have fun, blog it. Would love to read.
- deleted 2y ago[deleted]
- cloudhead 2y agoI wish rust took inspiration.. Same story regarding moving away from llvm.
- arlort 2y agoAssuming you mean something other that the gccrs project (and similar initiatives), why would Rust want to abandon llvm?
- vitaminCPP 2y agoThis is great. It really showcases zig's dedication to quality, IMO. I wish they took the time to communicate the intricacies of their toolchain. Some things I think are remarkable: Contrary to Rust, zig allows to cross-compile to MacOS. I think this implies that zig needed to build a custom linker! Regarding libc: - On Linux libc is not required because zig is using syscalls directly - On MacOS libc is required because of the lack of stable abi - On Windows libc is not required because zig links to windows kernel dll. To my understanding, this implies that a compiled zig program will work across all linux distributions! For C integration, I'm not knowledgeable enough to fully appreciate the work being done. but the fact that the cross-compiling also works out-of-box is mind-blowing to me.
- vitaminCPP 2y agoI don't know why my comment was duplicated. My appology.
- vitaminCPP 2y agoThis is great. It really showcases zig's dedication to quality, IMO. I wish they took the time to communicate the intricacies of their toolchain. Some things I think are remarkable: Contrary to Rust, zig allows to cross-compile to MacOS. I think this implies that zig needed to build a custom linker! Regarding libc: - On Linux libc is not required because zig is using syscalls directly - On MacOS libc is required because of the lack of stable abi - On Windows libc is not required because zig links to windows kernel dll. To my understanding, this implies that a compiled zig program will work across all linux distributions! For C integration, I'm not knowledgeable enough to fully appreciate the work being done. but the fact that the cross-compiling also works out-of-box is mind-blowing to me.