Re:Why does musl make my Rust code so slow? (2020)
by sidkshatriya on Tuesday December 12, 2023 @05:15PM
(#38619438)
You can use other allocators with musl. For example in Chimera Linux, musl uses the llvm scudo allocator instead of the default allocator packaged with musl libc.
Re:Why does musl make my Rust code so slow? (2020)
by Ericson2314 on Tuesday December 12, 2023 @11:54PM
(#38622829)
Yes and that's good, but it should be even easier. Rather than every libc needing to invent how to make the allocator pluggable, we should have that separation of concerns stock and shared by all implementations.
Re:Why does musl make my Rust code so slow? (2020)
by q66 on Wednesday December 13, 2023 @11:10AM
(#38629463)
the above is incorrect, chimera does use scudo but it patches musl to achieve that
and scudo is probably one of the few allocators that would work for this purpose, it absolutely cannot be applied to any allocator; there are some concerns that get in the way of that, e.g. the handling of ELF TLS in a libc (ELF TLS may not be and in musl's case is not available within the dynamic linker, which means you cannot use __thread and the likes anywhere within libc.so; scudo is designed to be flexible so you can get around it (we shove a pointer to the thread-local state directly in the pthread structure and manually mmap the data for it) but that is not necessarily the case with many other allocators, including mimalloc, hardened_malloc, and others)
Re:Why does musl make my Rust code so slow? (2020)
by flohofwoe on Wednesday December 13, 2023 @06:28AM
(#38625800)
The question that popped into my mind is rather: why does Rust rely on the C stdlib at all (e.g. why even call into musl or glibc). Shouldn't the Rust stdlib implement its own allocator which directly requests memory from Linux via syscalls?
Re:Why does musl make my Rust code so slow? (2020)
by Ericson2314 on Thursday December 14, 2023 @03:14PM
(#38646641)
That is what Go does. BSDs hate it. https://github.com/redox-os/relibc could be repurposed for this easily enough.
Musl should be able to exist without providing any allocator.