Hacker News new | ask | show | jobs
by goranmoomin 2243 days ago
TLDR for people who didn't read:

The speed difference came from the allocator.

Rust switched from jemalloc to the system allocator per ticket #36963[0] for various reasons (like binary bloat, valgrind incompatibility, etc...).

Go uses a custom allocator[1] instead.

To make 'Rust Go fast' (pun intended), one can use the '#[global_allocator]' to use a custom allocator (in this case, with the jemallocator crate) to make allocations fast again.

[0]: https://github.com/rust-lang/rust/issues/36963

[1]: https://golang.org/src/runtime/malloc.go

1 comments

The comments of Rust programmers here also suggest that the Rust implementation is, indeed, different from the Go implementation.
It was just a summary of the post contents - the post suggests that the biggest difference comes from the allocator.