-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
perf(detect-libc): faster musl check by looking for ldd file #19
Conversation
@lovell I don't know if |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, thanks for the PR, I've left a few thoughts and questions inline.
55ee3e1
to
908f5a1
Compare
Could we use this same approach for a potential |
@lovell How did you test linux musl? I'm trying to understand what is the output of |
Although we can probably determine the family from the $ docker run -it --rm alpine:3.18 cat /usr/bin/ldd
#!/bin/sh
exec /lib/ld-musl-x86_64.so.1 --list "$@" |
908f5a1
to
1153b46
Compare
9f62abe
to
1a66ea7
Compare
1a66ea7
to
d5eb2a6
Compare
Hey @lovell, any updates? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thank you. Is there anything else you wanted to add, or is this good for release?
It's good for a release! |
v2.0.2 now available, tudo bom, obrigado! |
* This string is used to find if the {@link LDD_PATH} is musl | ||
* @type {string} | ||
*/ | ||
const MUSL_ON_LDD = MUSL.toLowerCase(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This .toLowerCase()
is redundant since MUSL
on line 57 is already lowercase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did this just to make sure the text is always lowercase and a change to musl won't affect this constant.
But better than removing .toLowerCase
could be just putting the string literal, since they are different information even though it is the same string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, might be best to inline those strings in the getFamilyFromLddContent()
function since each is only used once, no need for a variable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PRs welcome 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created #20
Closes #18
Now, we use by default the comparison of check if
ldd
file exists.Performance
Before:
Now: