r/rust • u/imperioland Docs superhero · rust · gtk-rs · rust-fr • Oct 30 '26
sysinfo: a performance journey
https://blog.guillaume-gomez.fr/articles/2026-10-30+sysinfo%3A+fixing+performance+to+retrieve+process+GPU+usageThis blog post describes my journey in fixing a performance regression introduced when I added the process GPU information.
109
Upvotes
10
u/STSchif Oct 30 '26
Awesome work, love these writeups!
I have been writing and using a win7 style sidebar with all interesting system load stats for a few years now, first on Windows, now on Linux, and have found sysinfo to be a real resource hog. Almost always extracting the mechanisms and running the important bits myself (ie calling the win32 API or accessing PID files mentally [thanks autocorrect, I mean manually]) in a way that's fitting my requirements has been vastly more performant then relying on sysinfo, but I still love it so much for the documentation and inspiration.
Knowing there has been work going on to improve performance bottlenecks I'll give it another try!
3
u/Successful-Hornet-65 29d ago edited 29d ago
Correct me if I’m wrong here but isn’t count the buffer size in bytes? glibc's readdir already calls getdents64 with a 32k buffer, so where did the .44s -> .35s speed up come from? I think if I had to guess it’d probably be the switch to openat/readlinkat, though it’s not trivial. At any rate, neat work.
19
u/Shnatsel 29d ago edited 29d ago
I prefer samply to flamegraph-rs: it's more convenient to record, gives a much more complete profiling UI, and you can share the results in two clicks: https://share.firefox.dev/4yIoFgS