News for hackers. Stuff that matters.
Re:Rust is now overall faster than C in benchmarks by olodus on Sunday January 03, 2021 @08:47PM (#25627153)
Yeah I can understand why. Though I still prefer C in some ways simply because of its minimalism in the language, while still allowing for the kinds of things you want to be able to do if you wanna push your code to the limits. It is a bit scary sometimes writing in C though and sometimes I get a bit annoyed at how some things work or not work in it. I personally am hoping Zig can soon fill this minimalism trait in langs for me. C will probably always be the standard though and I do think more programmers should learn C better to become better programmers.

Rust is a good lang though. I am glad something else is pushing up there for the top spots. And more competition in performance is a good thing.

You don't always have to pick your sides. I just want to be able to write good code and be happy writing it :)

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.
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