4 ms·
The point was typical, typical Rust code is using Vec<>, typical Zig code is using arenas. Typical Rust code is using smart pointers, typical Zig/C code prefers
by cztomsik 3y ago
The point was typical, typical Rust code is using Vec<>, typical Zig code is using arenas. Typical Rust code is using smart pointers, typical Zig/C code prefers plain, copyable structs.
It is 100% possible to use such style in Rust/C++ (and then the performance will be same or maybe even in favor of rust, it might be the case) but people usually do not do that.
- pjmlp 3y agoIt shouldn't be hard to make Zig go to top place then, which is great opportunity to shine, given that they are still missing Zig entries, https://benchmarksgame-team.pages.debian.net/benchmarksgame/box-plot-summary-charts.html https://benchmarksgame-team.pages.debian.net/benchmarksgame/... https://www.techempower.com/benchmarks/ https://www.techempower.com/benchmarks/
- kristoff_it 3y agoZig can and does win plenty of those benchmarks, but ultimately it boils down to who is it that gets nerdsniped into working on a specific challenge. For example in this case Zig won big time over what C/C++/Rust people submitted: https://youtu.be/pSvSXBorw4A?t=1075 https://youtu.be/pSvSXBorw4A?t=1075 Zig is in the same ballpark as the ones mentioned above, so flohofwoe is right. But nevertheless I do think that cztomsik's point also still stands: how hard it is to make something fast will end up impacting the performance characteristics of the average program and library out there, and Zig does make it easier to write performant code than some other languages. Which is basically what happened here: https://zackoverflow.dev/writing/unsafe-rust-vs-zig/ https://zackoverflow.dev/writing/unsafe-rust-vs-zig/ In truth the same applies to correctness, which is also a point that the blog post above touches upon.
- igouy 3y ago> basically what happened here Pico benchmarks! https://github.com/zackradisic/rust-vs-zig/blob/master/benchmarks/fib.lox https://github.com/zackradisic/rust-vs-zig/blob/master/bench... https://github.com/zackradisic/rust-vs-zig/blob/master/benchmarks/method_call.lox https://github.com/zackradisic/rust-vs-zig/blob/master/bench... https://github.com/zackradisic/rust-vs-zig/blob/master/benchmarks/string_equality.lox https://github.com/zackradisic/rust-vs-zig/blob/master/bench... https://github.com/zackradisic/rust-vs-zig/blob/master/benchmarks/zoo.lox https://github.com/zackradisic/rust-vs-zig/blob/master/bench...
- deleted 3y ago[deleted]
- bmacho 3y ago> Zig can and does win plenty of those benchmarks, but ultimately it boils down to who is it that gets nerdsniped into working on a specific challenge. > For example in this case Zig won big time over what C/C++/Rust people submitted: https://youtu.be/pSvSXBorw4A?t=1075 https://youtu.be/pSvSXBorw4A?t=1075 That was a faulty benchmark with a simple unnatural footgun that the Rust people overlooked. I don't think it supports your claim that benchmarks typically boil down to who is it that gets nerdsniped into them. Sure, it can happen, it happened at least once, but in general?