Skip to content
This repository has been archived by the owner on Oct 28, 2023. It is now read-only.

Investigate musl performance issues #8

Open
Jake-Shadle opened this issue Sep 4, 2019 · 7 comments
Open

Investigate musl performance issues #8

Jake-Shadle opened this issue Sep 4, 2019 · 7 comments
Labels
bug Something isn't working

Comments

@Jake-Shadle
Copy link
Member

There is a huge performance gap between x86_64-unknown-linux-musl and x86_64-unknown-linux-gnu that needs to be investigated, as we use musl for our pre-built linux binaries.

Doing the same CLI operation shows how severe this performance gap is:

time target/x86_64-unknown-linux-musl/release/texture-synthesis --out out/04-2.png --no-progress transfer-style --style imgs/multiexample/4.jpg --guide imgs/tom.jpg

543.92s user
356.85s system
1808% cpu
49.812 total
time target/release/texture-synthesis --out out/04-2.png --no-progress transfer-style --style imgs/multiexample/4.jpg --guide imgs/tom.jpg

131.32s user
0.25s system
1605% cpu
8.193 total
@Jake-Shadle Jake-Shadle added the bug Something isn't working label Sep 4, 2019
@repi
Copy link
Contributor

repi commented Sep 4, 2019

wow

@maxburke
Copy link

maxburke commented Sep 5, 2019

Interesting. I’m not much help here but subscribing because I was just about to migrate our Rust services to musl...

@Jake-Shadle
Copy link
Member Author

So, replacing the system allocator with jemalloc basically returns musl performance to glibc, but this doesn't seem right as a "fix" as it would be sweeping a problem under the rug. The root of the problem would seem to be heap allocations occuring inside many different threads, which musl seems to not handle well at all. Reducing/removing/pre-allocating memory will probably improve performance for all targets, not just musl, so will investigate that later.

musl - master:
image

musl - jemalloc:
image

@zicklag
Copy link

zicklag commented Sep 9, 2019

Also might look into mimalloc if it still helps performance after investigating the possibility of reducing allocations. There are a couple of Rust global allocators for Mimalloc we could try.

@Qix-
Copy link

Qix- commented Nov 11, 2019

Just curious, is there an open issue about this over at the Musl tracker? Pretty confident they would love to know about this 🙃 This is an inexcusable performance hit.

EDIT: TIL Musl doesn't have a dedicated tracker, it seems. They have a mailing list described on their site. Might be worth it for a maintainer to direct them toward this issue.

@khodzha
Copy link

khodzha commented Feb 8, 2020

is this issue still a thing?

running time target/x86_64-unknown-linux-musl/release/texture-synthesis --out out/04-2.png --no-progress transfer-style --style imgs/multiexample/4.jpg --guide imgs/tom.jpg on master gives ~44 and ~42 seconds for musl/glibc correspondingly, and flamegraph of musl version doesnt look that bad on malloc

@Jake-Shadle
Copy link
Member Author

Good question, I haven't checked in a long time, thanks for the heads up!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants