Re:Rust is now overall faster than C in benchmarks
by dnautics on Sunday January 03, 2021 @11:23PM
(#25627916)
You'll be happy to know I implemented the n-body benchmarks game in zig 0.6.0 and it absolutely thrashed the rust version. Submitted it, but they don't take PLs not on the board currently.
[ Parent
| on HN ]
Re:Rust is now overall faster than C in benchmarks
by adamnemecek on Sunday January 03, 2021 @11:41PM
(#25627980)
But how much? Do you have an idea why?
Re:Rust is now overall faster than C in benchmarks
by dnautics on Monday January 04, 2021 @02:34AM
(#25628636)
Honestly I have no idea. You can try it yourself, or put it through godbolt:
https://gist.github.com/ityonemo/f34e0d3b4891f481863980a3142...
Note it could also be platform dependent. I'll give it a whirl on my own (new) machine.
Re:Rust is now overall faster than C in benchmarks
by huhnmonster on Monday January 04, 2021 @03:09AM
(#25628780)
Do you think that it may be caused by use of comptime? I have not looked at the benchmark implementations, but that kind of struck me as a reason
Re:Rust is now overall faster than C in benchmarks
by dnautics on Monday January 04, 2021 @04:35AM
(#25629227)
Well, I ran it again and now it's 10% slower than rust (the best rust impls have gotten better since I last tried); I think there's a simd optimization I'm missing, I'm not doing simd operations in the "pairs" phase