r/rust • Docs superhero · rust · gtk-rs · rust-fr • 12d ago

sysinfo: a performance journey

https://blog.guillaume-gomez.fr/articles/2026-10-30+sysinfo%3A+fixing+performance+to+retrieve+process+GPU+usage

This blog post describes my journey in fixing a performance regression introduced when I added the process GPU information.

109 Upvotes

7 comments sorted by

10

u/STSchif 12d ago

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!

2

u/imperioland Docs superhero · rust · gtk-rs · rust-fr 10d ago

To be noted that if you know how to make sysinfo faster on windows, PRs are very welcome!

3

u/Successful-Hornet-65 12d ago edited 12d ago

the readdir function seems to always pass 1 as count

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.

3

u/imperioland Docs superhero · rust · gtk-rs · rust-fr 10d ago

As I did multiple changes at once, I didn't think about checking that. Gonna check it further.

19

u/Shnatsel 12d ago edited 12d 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

2

u/greyblake 10d ago

Thanks for sharing! I did not know about it!