-
-
Notifications
You must be signed in to change notification settings - Fork 326
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
multithreading feature performance issues #1352
Comments
That is pretty bad indeed. Now I need some extra info: which API are you using and with which arguments? The idea would be to only trigger multi-threading above a given threshold. |
Total counts of all calls made are:
edits: missed a few calls |
one thing i did notice last night testing, it seems that on my weaker/slower/less beefy laptop, the time difference is alot less drastic |
The only API here using multi-threading is |
i am not, it's only instanced once in the whole program, and only refreshed on creation |
I'm starting to be out of ideas. 😅 Is the total runtime of your program faster or slower with multithreading enabled? It's normal that it uses more resources and system time but overall, it should still run faster (hopefully). |
It's slower with the multithreading (as seen in the benchmarks above) |
running the same test on an hp laptop with a ryzen 5300U and crystal linux, it's 173.7ms with threading, and 69.6ms without (both averaged over 100 runs). so the threading slowdown can be reproduced even on low power systems |
windows with multithread: 154.9ms seems to be a linux specific issue. all that is needed for the test is: [package]
name = "multithreadtest"
version = "0.1.0"
edition = "2021"
[dependencies]
sysinfo = {version="0.31.4", default-features=false, features=["component", "disk", "network", "system", "user"]} use sysinfo::{ProcessRefreshKind, RefreshKind, System};
fn main() {
let sys = System::new_with_specifics(RefreshKind::new().with_processes(ProcessRefreshKind::everything()));
println!("{:?}", sys);
} on android through termux it seems to not matter which is used, may change if used in an app |
Describe the bug
Issue is present on a cachyos, ubuntu, and gentoo system. untested on windows/mac.
In testing, it appears for short running programs that call sysinfo, the rayon overhead can double or triple runtime of a program, which is undocumented as is the multithreading option. All testing was done in release mode on version
0.31.4
with nothing except a terminal running, and benchmarked using hyperfine.multithreading
Disabled:multithreading
Enabled:To Reproduce
https://github.com/Vortetty/YATFPBNWS/tree/master
Changing sysinfo to use default features results in a runtime increase of 4x in the above example on my main system (9900x/32gb ram)
example only runs on linux systems, and may not work on all of them as it is still being worked on, but seems to work on my 3 test systems fine.
The text was updated successfully, but these errors were encountered: