Closed Carterpersall closed 6 months ago
It's nice to see people building tools with libmacchina :)
I'd be more inclined to fix (or consider a pull request addressing) the performance issues causing the slowdowns than depend on yet another package which we may or may not need to solve this pretty straightforward problem.
I'm going to close this issue for now, please consider my feedback regarding the unnecessary addition of a dependency if you decide to open a pull request.
I've been learning Rust over the last little while by making a fetch program. While working on getting rid of major slowdowns in the code, I found that on Linux
count_pkgs()
is really slow (over 200 milliseconds). I eventually tracked the slowdown tocount_dpkg()
and more specifically toget_entries()
. It seems that the method currently used to get the entries in a directory is very slow.So I did some digging online and found the crate Rust_Search (https://github.com/ParthJadhav/Rust_Search). After throwing together an implementation with it, the speed of my fetch program with only package counting enabled went from 232ms to 14.1 ms (16.45x faster).
Here is the code I made that replicates the functionality of
count_dpkg()
: