8 ms·
Zig ELF Linker Improvements Devlog
- teabee89 4mo agoThis is the promise that blew my mind the first time I heard about Zig years ago. So happy to see this become reality!
- quikoa 4mo agoThese improvements are quite promising and I'm looking forward to giving that a spin once it is released. Will the Windows side for 0.17.x get some compiler improvements as well or is this Linux only?
- squeek502 4mo agoMight not make it in time for 0.17 but there is a contributor making progress on the COFF linker: https://codeberg.org/kcbanner/zig/src/branch/coff_linker_wip https://codeberg.org/kcbanner/zig/src/branch/coff_linker_wip
- bcardarella 4mo agoI wonder how much this work being pushed forward right now is a response to the Bun drama.
- kristoff_it 4mo agoNone of it, we've been working on this stuff for a long time already, scroll the devlog backwards, you will find plenty of entries on that topic. It's the opposite: people have become more receptive to communication about this work now that there's "drama" attached to it. This post I co-authored with Andrew is from 2020. In it we announce the idea of getting rid of LLVM from the debug build pipeline and since then work has been steadily going forward, it's just not trivial to bootstrap a full compiler pipeline for all major targets, but we're finally getting there. https://kristoff.it/blog/zig-new-relationship-llvm/ https://kristoff.it/blog/zig-new-relationship-llvm/
- bcardarella 4mo agoI'm very glad to see the work, thank you for all of the efforts.
- mi_lk 4mo agoSome people really can’t operate without stirring unnecessary drama. What if that’s true and what if that’s not true?
- dzbarsky 4mo agoNone? All of these things were in flight for a while and given Zigs anti-AI stance i think they wrote off Bun ever since the acquisition
- dnautics 4mo agowhat anti-ai stance? i have multiple projects in zig that are pretty much written by AI, no problem.
- mihaelm 4mo agoThey're probably refering to their strict "No LLM / No AI" policy: https://codeberg.org/ziglang/zig/src/branch/master/README.md#strict-no-llm-no-ai-policy https://codeberg.org/ziglang/zig/src/branch/master/README.md... which applies to contributing to the Zig project. The "contributor poker" blog post should probably be a required reading to understand where it comes from: https://kristoff.it/blog/contributor-poker-and-ai/ https://kristoff.it/blog/contributor-poker-and-ai/ "Anti-AI stance" is painting it with too broad of a brush. You're definitely not breaching any CoC or whatever by using AI for your Zig projects.
- cafebabbe 4mo agoThere is absolutely no "Bun drama", there are just two projects with different goals and methodologies, mutually incompatible. All this thing is just a small bunch of bored, terminally-twitting people ... In any case, I'm super glad for this milestone (and impressed!).
- bpavuk 4mo agoI am so used to thinking that Zig, Rust, and the likes are only viable in niches where C is viable, but no. not anymore at least - once this linker and incremental compilation on other targets land, Zig will become THE C replacement and that will let me iterate at the speed of JS or Python with performance of C or Rust. even Andrew's initial dream - to create a DAW with uncompromising UX - will become much easier to create. once someone creates a Zig-native immediate-mode or reactive UI framework, that is. I am still a little salty about `@cImport` removal, though! without it, I can't confidently call it "Kotlin of C" anymore.
- gliptic 4mo ago> Zig-native immediate-mode dvui?
- bpavuk 4mo agomany thanks, will look into that...
- alexboehm 4mo agoIt's already sort of possible. https://codeberg.org/fellowtraveler/flux https://codeberg.org/fellowtraveler/flux here is my Zig DAW. It has been amazing for the audio engine, but the ui is currently using imgui.
- lukaslalinsky 4mo agoI've tried building your project, but hit problems due to dependency hash mismatches. Do you have a screenshot somewhere?
- akazantsev 4mo ago> Kotlin of C That sounds good on paper. But as a guy who tried to learn Kotlin and only it. It comes with baggage to learn Java to use its libraries because... You know... they interact seamlessly and stuff. In the end, for a new learner, it might actually make things harder. Nothing about Zig and C here, just a bit salty from my experience with Kotlin.
- derefr 4mo agoSo, this linker does fast incremental linking, which is great for development iteration speed. But I assume that any kind of incremental linking, is mutually exclusive with link-time optimization? I.e. you'd never want to use this option for a release build?
- deleted 4mo ago[deleted]
- dapperdrake 4mo agoResearch "cl:define-compiler-macro". It has been done before. And LTO is when the C people and the C++ people started to agree.
- wsve 4mo agoFor releases you're generally building it all at once in a merge request/deployment pipeline anyway
- ksec 4mo agoAre there any other languages that offer similar compilation performance. The only one I know of or remember is Turbo Pascal.
- mgrandl 4mo agoIsn’t go (with cgo disabled) still at least as fast to compile?
- ozgrakkurt 4mo agoCompilation speed isn’t that much of a factor of language as far as I can understand. It is more related to how optimization is done and how machine code is generated. Also obviously it is about how fast the actual implementation of the compiler/build-system is.
- mattgrice 4mo agoDefinitely not true. Otherwise we would have really fast C++ compilers and no one would ever have implemented hacks like precompiled headers.
- pjmlp 4mo agoThat hack is because of C. Definitely true when using VC++ with C++20 modules and MSBuild. It also helps not compiling everything from source as many UNIX folks do.
- flohofwoe 4mo ago> Definitely true when using VC++ with C++20 modules and MSBuild. Lol, sorry, but as soon as MSBuild is involved the compiler can be infinitely fast and you'd still need to be waiting for the build. Also the main problem of MSVC is the slow linker, and that isn't fixed by C++ modules. This is also the first time I'm hearing that C++ modules actually help with compilation speed in real world projects - the best I've heard so far is that they're a bit faster than precompiled header but not by much, which simply isn't good enough for typical C++ projects.
- librasteve 4mo agoThere has been some speculation about porting the Raku backend (Meta-Object Aware Runtime Virtual Machine - MOARVM)from C to Zig. For example the wider set of Zig Hash options could be a big optimization. Since you ask, the front end is self hosting in NQP and with the ripening RakuAST project increasingly in Raku Grammars. The new AST (6.e.PREVIEW) will bring much better introspection and high level optimization handles. So the potential to refactor/rewrite the VM for substantial speed gains is wide open. Anyway those with skills and interest are welcome to join the -Ofun at https://raku.org/community https://raku.org/community
- nagaiaida 4mo agominor correction, moar stands for metamodel on a runtime, not meta-object aware runtime
- librasteve 4mo agored face … thanks for the correction … I guess I should have looked at https://moarvm.org https://moarvm.org
- GuB-42 4mo agoI am following Raku and Zig from afar, and they both share similarities in that both languages are "optimized for fun" in a way, so no surprize that they come together. Zig focus on compilation speed and give developers control (even more so than C). Raku, as a Perl descendant is a giant toybox and there is no one telling you not to use them. Both have in common that they give a lot of freedom to developers, which is really enjoyable. They also have in common that they are not very mature and have a limited market share and fine with it, and a community that looks genuinely nice. The opposite of Rust. The language has the "bondage and discipline" philosophy, kind of like ADA, the idea being that it does everything it can to stop you from making mistakes. There is a lot of value in that, but it is not particularly fun. Its community was similarly defined by rules, its code of conduct was infamous, again, it serves a purpose but to me, putting the rules forward doesn't make the community look like a fun place to be. And there is the evangelism, the Rust community is aggressive "rewrite it in Rust!", "no memory unsafe languages!", etc... I have never seen such attitude from the Zig community. Sure they love their language and will tell you it is the best in the world, but they will not say that you are wrong for not using it. As for Raku, they don't seem to care that no one else use their language, they just hope it will happen eventually if they continue going forward.
- c0rruptbytes 4mo agoi'm not cool and hip like hacker news devs, but I've been seeing Zig a lot, is this the new cool thing on the street? no more Rust?
- agluszak 4mo agoZig's been around for ~10 years. It's more low-level and lightweight than Rust. Different goals, different trade-offs. If Rust is the new C++, Zig is the new C.
- Ygg2 4mo agoStill no 1.0 version though. So technically it's year 0.
- peesem 4mo ago"technically" usually means something like "strictly", not "by a completely different metric". work takes time. zig has had a decade of work put into it.
- Ygg2 4mo agoTechnically means according to a strict, often legal definition. The strict definition being we don't count developments that happened before version 1. Like when we talk about Rust, we don't mention the virtual threads or GC or the @ symbol for GC references. Even though those all happened during its development.
- peesem 4mo agoand when people talk about zig, they don't usually mention that zig used to have goto, casting syntax like `T(val)`, a rule that said you couldn't pass containers by value, language-level async, some truly awful syntax for what is now `try` and other operators, etc. both languages took time and work to realize that these features were not for them. very strange to deny that. also, nitpick: they said zig has been around for ten years. this is, strictly, correct. the zig project has existed for ten years, just like how rust has existed for about 20, now. a project still exists if it is pre-1.0. nobody was talking about versions before you.
- onlyrealcuzzo 4mo agoI've been building a memory safe language that transpiles to Zig with a Go-like runtime that can run interpreted (no GC) or compiled - high-level that feels like Ruby but with incremental typing like TypeScript. The Zig team between 0.16 and this has really made me glad I chose Zig as the target instead of Rust - which probably would've been a lot easier to target (since it's already memory safe). I believed it had the best build system design and was the best transpilation target, and I really believe that 6 months later. The main reason I wanted no GC is because I think aliasing is the root of all evil, and I want a language with zero global complexity (but doesn't require a PhD to use).
- keithasaurus 4mo agoWorking on something kinda similar. No GC, Python feel, managed memory, performance approaching C. It's here: https://blorp-lang.org https://blorp-lang.org if you want to compare approaches.
- onlyrealcuzzo 4mo agoIt looks pretty cool! It's not clear how much concurrency is part of what you're trying to solve. All I could find is this: https://blorp-lang.org/docs/concurrency/ https://blorp-lang.org/docs/concurrency/ - which doesn't give me much as to how you handle shared memory, safety, deadlocks, etc. Definitely down to chat more - looks like you've got some traction, which is impressive and awesome! I'd love to pick your brain as it appears you're further along than I am.
- keithasaurus 4mo agoYeah, concurrency in blorp doesn't allow shared mutable references, so deadlocks aren't really a concern. Otherwise it's meant to be simple-ish -- virtual threads, channels, no async/await. Pure functions allow safe parallelism naturally, so that's fairly straightforward, though the API is still incomplete, for example the "Parallel" section here: https://blorp-lang.org/docs/lists/ https://blorp-lang.org/docs/lists/. It's still under heavy development (working on it right now). What are the over-arching goals of your language?
- androiddrew 4mo agoI really would like a 1.0, then I think it can actually be adopted by business.
- up2isomorphism 4mo agoI don’t think either zig or rust can replace C, no matter how much this kind of work. They will of course improve its own language. The only language that can replace C is a language is as simple as C. None of them are simple language.
- setheron 4mo agoIs there a design dock or explanation about how it can do incremental linking? It's evaded other linkers in the past: gcc, llvm, mold etc....