Nice achievement. Curious about this though: > building the compiler itself used to require 9.6GB of RAM, while now it takes 2.8GB. Why is the RAM usage so high? It was only a few years back and we were building C++ compilers on machines with barely 16MB.
I don't know about Zig specifically, but things using LLVM tend to be absurd memory hogs. I remember having to disable parallel compilation for clang to prevent OOM issues.
Zig Is Self-Hosted Now, What's Next?
21–30 of 159 posts
Re: Zig Is Self-Hosted Now, What's Next?
#22Earlier quoted context omitted.
I'm not so familiar with Zig, are you saying that the compiler fails to compile correct (i.e. according to spec) code?
We're using the C++ compiler rather than the self-hosted compiler because the self-hosted compiler does not yet support async. Yes, it sometimes fails to compile correct code (by crashing) or compiles correct code to incorrect code.
Re: Zig Is Self-Hosted Now, What's Next?
#23Nice achievement. Curious about this though: > building the compiler itself used to require 9.6GB of RAM, while now it takes 2.8GB. Why is the RAM usage so high? It was only a few years back and we were building C++ compilers on machines with barely 16MB.
Hey, back in the day, I used a Pascal compiler on CP/M that worked with 64K.
Modern compilers lex then parse into tree structures and then do lots of mutations and traversals of that tree to optimize in different ways for different architectures, and more code is included at once to make more optimizations possible and on and on and on.
Re: Zig Is Self-Hosted Now, What's Next?
#24Earlier quoted context omitted.
I'm not so familiar with Zig, are you saying that the compiler fails to compile correct (i.e. according to spec) code?
Yeah, theres a surprising amount of stuff that's buggy, think `if` or `recursive structs with pointers` level stuff.
Re: Zig Is Self-Hosted Now, What's Next?
#25Correctness please. Zig is a way too simple language to justify all the really easy to hit bugs. I'd give everything for a zig compiler that's 10 times as slow but actually compiles my code. Also testing infrastructure. Zig really needs fuzzing and property testing tooling build-in. Hitting stage 2 with arbitrary autogenerated zig code and IR, would have really helped detect regressions for example.
Re: Zig Is Self-Hosted Now, What's Next?
#26Earlier quoted context omitted.
We're using the C++ compiler rather than the self-hosted compiler because the self-hosted compiler does not yet support async. Yes, it sometimes fails to compile correct code (by crashing) or compiles correct code to incorrect code.
Quoted post unavailable.
Re: Zig Is Self-Hosted Now, What's Next?
#27Earlier quoted context omitted.
Yeah, theres a surprising amount of stuff that's buggy, think `if` or `recursive structs with pointers` level stuff.
Can you substantiate this further? I don't see how basic stuff like that could be subtly buggy, the Zig devs are very qualified IMO.
Re: Zig Is Self-Hosted Now, What's Next?
#28Earlier quoted context omitted.
Looks like your complaint was a known tradeoff. > The self-hosted compiler brings many advantages, but it did cost us a significant amount of effort and time. While Zig is still going up in popularity and starting to make a tiny dent in the industry, people that have been following along for long enough will know that this work has reduced our momentum in the last two years. > Bug fixes in the compiler have been ofte…
Your quoted sentence talks about bugs in the old C++ compiler, I'm talking about bugs in both compilers. Pretty much all of the talks and blog posts on the `in-Zig` compiler are about better performance, lower memory footprint, e.t.c. I would much rather have heard a talk about how they improved correctness through automatic testing, formal methods, simple language design e.t.c. A language that (does or doesn't) comp…
Re: Zig Is Self-Hosted Now, What's Next?
#29Re: Zig Is Self-Hosted Now, What's Next?
#30Correctness please. Zig is a way too simple language to justify all the really easy to hit bugs. I'd give everything for a zig compiler that's 10 times as slow but actually compiles my code. Also testing infrastructure. Zig really needs fuzzing and property testing tooling build-in. Hitting stage 2 with arbitrary autogenerated zig code and IR, would have really helped detect regressions for example.
But - it's plastered all over the entire project that it is a work in progress. This post itself is talking about how for loops are getting broken. It's an ambitious project with a talented and ambitious team, and their vision and execution so far has been awesome. I'm not using Zig for anything resembling production code at the moment - because it's going to break. But when it stabilizes - there is a lot of potential.