You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a program that runs for a very short time (<100 ms), that needs to know what Linux distro it is on. Unfortunately using os_info results in a lot of (relative) overhead due to it calling out to external binaries. About 35 ms extra in fact. The program runtime is performance criticial, it gets invoked many times from a shell script.
It seems that lsb_release is the worst offender (at ~35 ms). Removing lsb_release from path brings the overhead down to a more manageble ~4-5 ms. There is an old issue #319 about this, but no progress.
The remaining invoked programs seem to be:
getconf
uname
Somehow reinvoking the program itself? At least it looks like that in perf/hotspot:
Both getconf and uname should be possible to replace with calls to nix, libc or even rustix.
I have no idea why it looks like os_info is reivoking my program (paketkoll) though. But that shouldn't be needed either really. And yes, that extra process goes away if I remove os_info (and hard code in what distro is in use, in this case Arch Linux).
The text was updated successfully, but these errors were encountered:
I agree with your concerns, but unfortunately I don't have time right now to fix that. Hopefully I will be able to look into that in about a month, but I don't want to promise anything. I welcome pull requests if you would like to implement that yourself.
I would argue that a frequently-running tool does not really need to call os_info every time, since that info is unlikely to change. Even if it would avoid calling lsb_release it would do extra work you don't need.
I suggest caching the info you need in /run
I have a program that runs for a very short time (<100 ms), that needs to know what Linux distro it is on. Unfortunately using os_info results in a lot of (relative) overhead due to it calling out to external binaries. About 35 ms extra in fact. The program runtime is performance criticial, it gets invoked many times from a shell script.
It seems that
lsb_release
is the worst offender (at ~35 ms). Removinglsb_release
from path brings the overhead down to a more manageble ~4-5 ms. There is an old issue #319 about this, but no progress.The remaining invoked programs seem to be:
Both getconf and uname should be possible to replace with calls to
nix
,libc
or evenrustix
.I have no idea why it looks like os_info is reivoking my program (
paketkoll
) though. But that shouldn't be needed either really. And yes, that extra process goes away if I remove os_info (and hard code in what distro is in use, in this case Arch Linux).The text was updated successfully, but these errors were encountered: