I was looking for good global_allocator
replacements, for use in Rust code compiled to wasm. Wee-alloc seems to optimize for its own code size, and not for performance. Are there any other known good replacements that would be usable in Rust targeting wasm?
There are crates for tcmalloc / mimalloc crates on crates.io, which are all bindings to the C implementation, so that doesn't seem to be viable when compiling to wasm.
dlmalloc is the other major one I know about.
Thanks, I'll try that!
I believe though the Rust-default allocator is dlmalloc, so using the crate manually probably won't have much of an impact
I'm not actually personally aware of any compiled-to-wasm allocators other than dlmalloc and wee_alloc at the moment
emscripten has a couple too, but it might be a bit of a build nightmare linking them into Rust
I had dreams of making a wee_alloc
2.0 that actually had decent performance, rather than just really good code size, and wrote https://github.com/fitzgen/intrusive_splay_tree towards that goal, but then never actually wrote an allocator using that. @Benjamin Bouvier maybe you can pick up the torch :)
https://github.com/wingo/walloc
ah yes I forgot about that one. I think it is also aimed at small code size, rather than performance, so might not be what bnjbvr is looking for
also not a crate. sorry, just a tangent.
I have had the same concerns. I think allocation-heavy workloads suffer quite a lot at the moment.
mimalloc is pretty small, has good performance and actually supports wasm!
I don't think the current mimalloc wrapper crates support it though, so there's probably some build/linking tinkgering required.
Last updated: Nov 26 2024 at 00:12 UTC