2 ms·
But you can use a custom allocator in Rust: https://doc.rust-lang.org/1.9.0/book/custom-allocators.html https://doc.rust-lang.org/1.9.0/book/custom-allocators.h
by heavenlyblue 7y ago
But you can use a custom allocator in Rust: https://doc.rust-lang.org/1.9.0/book/custom-allocators.html https://doc.rust-lang.org/1.9.0/book/custom-allocators.html
You don’t have that option in Go
- steveklabnik 7y ago(those are very old docs, you want to link to https://doc.rust-lang.org/stable/std/alloc/trait.GlobalAlloc.html https://doc.rust-lang.org/stable/std/alloc/trait.GlobalAlloc...)
- masklinn 7y ago> But you can use a custom allocator in Rust: https://doc.rust-lang.org/1.9.0/book/custom-allocators.html 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.
- yencabulator 7y ago> 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.