3 ms·
As a counterpoint, we've written several thousand lines of code in Zig for a new financial accounting database called TigerBeetle [1], and all we've seen were t
by _vvhw 5y ago
As a counterpoint, we've written several thousand lines of code in Zig for a new financial accounting database called TigerBeetle [1], and all we've seen were two compiler bugs. The first was already fixed a few hours before we reported it, and the second was not a showstopper and something we could easily work around.
On the other hand, because Zig has incredible velocity, we're also seeing that std lib contributions or fixes we make (e.g. io_uring) are landed quickly, and that the community has some of the most talented programmers we've seen, who are also well aware of where the language is at (and like you, also looking forward to self-hosted).
As for TigerBeetle, when we made the decision to go with Zig, the only alternative for us was C since we needed a safe way to handle memory allocation failure and also wanted a simple language with high orthogonality and power, and C interop. However, C's toolchain even then was still not as "ready" as Zig's and Zig also presented a unique approach to safety (e.g. the compiler can check that all syscall errors are handled at compile time, and integer arithmetic and overflow is checked by default) plus comptime, which is a force multiplier.
To be fair, the days of debugging we save through Zig's safety compared to C's undefined behavior, we could easily spend a few hours contributing small fixes back to the language. And breaking changes between releases have also been fairly tame, and the changes welcome. We appreciate the velocity here.
The final insight for us was realizing that it would also take us some time to get our project to production, and that our roadmap would probably intersect with Zig's stability. We go into this decision some more in the Q&A at the end of our Zig SHOWTIME talk [2].
We could have skated to where the puck was at, or where we believed it would be, and we picked the latter. Technological waves can be incredible if you can spot the value ahead of the curve. In hindsight, this decision has paid off again and again. We would never go back to C. For new projects, there are a good many reasons to pick Zig, and for projects that may have a long half-life, this decision may be all the more important.
[1] https://www.tigerbeetle.com https://www.tigerbeetle.com
[2] https://www.youtube.com/watch?v=BH2jvJ74npM https://www.youtube.com/watch?v=BH2jvJ74npM (TigerBeetle — A Million Financial Transactions Per Second In Zig)
- ksec 5y agoThis is going completely off topic but Tigerbeetle is really interesting. Is it the first of its kind of are there many other financial accounting databases?
- _vvhw 5y agoHey, thanks for the question! I'm answering over in our Discord just so I don't hijack the thread. Pretty awesome what Michal is doing for Zig gaming, and I hope you'll also consider sponsoring him on GitHub sponsors: https://github.com/sponsors/michal-z https://github.com/sponsors/michal-z
- ddrdrck_ 5y agoFor the sake of curiosity, did you consider Rust, and if yes why did you consider it was not suitable for your needs ? I know Zig and Rust are quite different languages, but it is my understanding that they share the same low-level approach without sacrificing safety
- deleted 5y ago[deleted]