News for hackers. Stuff that matters.
Re:Making Rust as Fast as Go by molf on Sunday May 03, 2020 @11:28AM (#23059553)
> Implausible benchmark results are almost always an indicator of the incompetence of the person performing the benchmark.

An ad hominem attack surely isn't needed.

Re:Making Rust as Fast as Go by masklinn on Sunday May 03, 2020 @12:02PM (#23059815)
And that's really too bad because I think the rest of the comment is spot-on as the fundamental issue is that Rust simply delegates to the system allocator, and MacOS's allocator is pretty slow.

As a result, while Rust allows very explicitly and relatively easily removing allocations (compared to C or C++), getting the most performances out of your program also requires doing so, unless you use a non-system allocator with better support for the workload.

Re:Making Rust as Fast as Go by heavenlyblue on Sunday May 03, 2020 @12:15PM (#23059914)
But you can use a custom allocator in Rust: https://doc.rust-lang.org/1.9.0/book/custom-allocators.html

You don’t have that option in Go

Re:Making Rust as Fast as Go by masklinn on Sunday May 03, 2020 @01:33PM (#23060514)
> But you can use a custom allocator in Rust: https://doc.rust-lang.org/1.9.0/book/custom-allocators.html

That is true — and was demonstrated by the article as its "fix" was to use jemalloc, but even a custom allocator will usually be less performant than a high-performance GC there, because the GC's allocator has more insight into the requirements and workloads.

It might be possible to give that insight to a custom allocator by using the allocator's custom APIs, but this requires a deeper integration between the program and the allocator.

Re:Making Rust as Fast as Go by steveklabnik on Sunday May 03, 2020 @12:33PM (#23060046)
(those are very old docs, you want to link to https://doc.rust-lang.org/stable/std/alloc/trait.GlobalAlloc...)
Re:Making Rust as Fast as Go by yencabulator on Sunday May 03, 2020 @05:42PM (#23062079)
> You don’t have that option in Go

Sure you do. You can even build one from nothing but mmap in pure Go. It just won't be part of the garbage collection, so you get malloc/free or arenas etc, just like in C/Rust/whatever.