orhun / git-cliff

A highly customizable Changelog Generator that follows Conventional Commit specifications ⛰️
https://git-cliff.org
Apache License 2.0
9.35k stars 201 forks source link

MUSL version is very slow compared to shared lib one #630

Open inglor opened 6 months ago

inglor commented 6 months ago

Is there an existing issue for this?

Description of the bug

The musl verison of the application is slow compared to the one using glibc one.

Steps To Reproduce

Execute git-cliff musl and observe being slow

Expected behavior

Same performance as glibc

Screenshots / Logs

No response

Software information

Additional context

No response

welcome[bot] commented 6 months ago

Thanks for opening your first issue at git-cliff! Be sure to follow the issue template! ⛰️

orhun commented 6 months ago

I don't have much experience with MUSL but I ran a profiler for comparison:

There isn't a big difference here. It might be a good idea to investigate the calls though.

Can you share the repo you are running git-cliff with?

inglor commented 6 months ago

Unfortunately no since it's internal at work. But can run profiler myself potentially.

orhun commented 6 months ago

Sounds good (it's samply), let me know.

orhun commented 6 months ago

Here are some instructions:

git clone https://github.com/orhun/git-cliff && cd git-cliff/

cargo build
samply record target/debug/git-cliff --no-exec -w "$workdir"

rustup target add x86_64-unknown-linux-musl
cargo build --target x86_64-unknown-linux-musl
samply record target/x86_64-unknown-linux-musl/debug/git-cliff --no-exec -w "$workdir"

Then on the browser you can upload profile.json at top right.

orhun commented 6 months ago

Had any chance to try out the profiler?

inglor commented 6 months ago

I did but showed nothing obvious. If the flamegraph seems the same I'm thinking it has to do with the loading of shared libs before the execution of the program itself. The environment it's running on is in AWS Linux 2 (with an old glibc version that's why I'm using musl) and has some 'enterprise' daemons running so I'm assuming it's scanning everything before it tries to execute them? Speculation from my side.

orhun commented 6 months ago

Yeah, that might be the case. Can you share some execution times? I'm just curious about how slow it is.

Also there is this blog post from 2020 FWIW: https://andygrove.io/2020/05/why-musl-extremely-slow/