-
When trying out rsbuild on one of our projects, I've found out, that running it in alpine is roughly 5x slower than running it in debian (at least with docker desktop on windows 10). I'm curious if this is expected or a potential performance bug. Just compare build times between these: npm run build
docker run -it --entrypoint=npm -v "$PWD:$PWD:rw" -w "$PWD" node:20.11.1-bookworm-slim run build
docker run -it --entrypoint=npm -v "$PWD:$PWD:rw" -w "$PWD" node:20.11.1-alpine3.18 run build I noticed this because first I used npm locally, giving me ~8 seconds, then I plugged it into our CI script and came out with ~40 seconds, which kept me digging until I tried switching to a Debian image in the CI script. I'm posting this here and not in rsbuild because this is likely a binary/compiler/rust thing than it is configuration. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
yea it's as expected - musl's malloc implementation is as 4 to 8 times slower as glibc's. please always use glibc on performance sensitive sceniros. alternatively, redirecting malloc to microsoft's mimalloc will significantly help the performance. i created a repo to show how malloc implentations affect performance: https://github.com/xc2/rspack-stress/blob/main/malloc-bench/malloc-bench.bash tldr; bench result:
|
Beta Was this translation helpful? Give feedback.
-
thanks @uncaught, i just checked that the cost is mainly in rust side but not limited in the nodejs side. then i tried replacing the allocator with mimalloc for musl target, and rspack's working as efficiently as it does on debian gnu. |
Beta Was this translation helpful? Give feedback.
-
Closed in #6071 |
Beta Was this translation helpful? Give feedback.
yea it's as expected - musl's malloc implementation is as 4 to 8 times slower as glibc's.
please always use glibc on performance sensitive sceniros.
alternatively, redirecting malloc to microsoft's mimalloc will significantly help the performance.
i created a repo to show how malloc implentations affect performance: https://github.com/xc2/rspack-stress/blob/main/malloc-bench/malloc-bench.bash
tldr; bench result: