Re:Why does musl make my Rust code so slow?
by liuliu on Tuesday May 05, 2020 @01:08PM
(#23082261)
Do you have any extra readings on the rationale of building their own malloc rather than integrating mimalloc or jemalloc?
[ Parent
| on HN ]
Re:Why does musl make my Rust code so slow?
by jessermeyer on Tuesday May 05, 2020 @01:19PM
(#23082375)
Not any first hand, but reading their principles suggests that simplicity and ease of deployment are probably relevant. https://musl.libc.org/about.html
Thanks. Taking on malloc and being competitive with much less code (mimalloc is around 6k, and it is the smallest I know that is still competitive) would be a great feat. Would be interesting to follow the development.
Re:Why does musl make my Rust code so slow?
by harrygeez on Tuesday May 05, 2020 @01:19PM
(#23082383)
well one of the stated goals of musl is to be simple and correct, and all those mallocs are anything but simple
Re:Why does musl make my Rust code so slow?
by littlestymaar on Tuesday May 05, 2020 @02:39PM
(#23083268)
That's true for jemalloc, but mimalloc is pretty simple. The reference paper is pretty short and really accessible and IIRC the implementation is around 5klocs. I doubt musl's implementation would much simpler than this.
5kloc is about 10x larger than musl's existing (old) malloc in source lines. I suspect lots of that is low code density, comments, etc.
I have to lookup what exactly mimalloc is/does every time someone mentions it, because the readme/documentation isn't very descriptive except discussing extensions outside the normal API. I didn't have time to dig through this again today. But I did look at it in some depth on several occasions in the past and it really wasn't suitable for or comparable to what we're doing in musl.
Re:Why does musl make my Rust code so slow?
by littlestymaar on Thursday May 07, 2020 @01:56AM
(#23100123)
Thanks for clarification, didn't imagine that musl's malloc was that minimalist.
You should definitely have a look at the paper [1] it's only ten page long! (Excluding benchmarks and references)
[1]: https://www.microsoft.com/en-us/research/uploads/prod/2019/0...
Re:Why does musl make my Rust code so slow?
by AndyKelley on Tuesday May 05, 2020 @01:27PM
(#23082472)
This is a libc implementation. The null hypothesis is that it implements libc, rather than porting a different libc implementation.