I made a replacement for the venerable paccheck. It checks if files managed by the package manger have changed and if so reports that back to the user. Unlike paccheck it is cross distro (supports Debian too and could be further extended), and it uses all your CPU cores to be as fast as possible.
Oh and it is written in Rust (that may be a plus or minus depending on your opinion, but it wouldn't have happened at all in any language except Rust, and Rust makes it very easy to add this sort of parallelism).
There are more details (including benchmarks) in the readme on github. Maybe it is useful to some of you.
(The main goal of this project is not actually the program produced so far, but to continue building this into a library. I have a larger project in the planning phase that needs this (in library form) as part of it.)
I have only implemented for checking all packages at the current point in time (as that is what I need later on). It could be possible to add support for checking a single package.
Thank you for reminding me of pacman -Qkk though, I had forgotten it existed.
I just did a test of pacman -Qk and pacman -Qkk (with no package, so checking all of them) and paketkoll is much faster. Based on the man page:
pacman -Qk only checks file exists. I don't have that option, I always check file properties at least, but have the option to skip checking the file hash if the mtime and size matches (paketkoll --trust-mtime). Even though I check more in this scenario I'm still about 4x faster.
pacman -Qkk checks checksum as well (similar to plain paketkoll). It is unclear to me if pacman will check the checksum if the mtime and size matches.
I can report that paketkoll handily beats pacman in both scenarios (pacman -Qk is slower than paketkoll --trust-mtime, and pacman -Qkk is much slower than plain paketkoll). Below are the output of using the hyperfine benchmarking tool:
$ hyperfine -i -N --warmup=1 "paketkoll --trust-mtime" "paketkoll" "pacman -Qk" "pacman -Qkk"
Benchmark 1: paketkoll --trust-mtime
Time (mean ± σ): 246.4 ms ± 7.5 ms [User: 1223.3 ms, System: 1247.7 ms]
Range (min … max): 238.2 ms … 261.7 ms 11 runs
Warning: Ignoring non-zero exit code.
Benchmark 2: paketkoll
Time (mean ± σ): 5.312 s ± 0.387 s [User: 17.321 s, System: 13.461 s]
Range (min … max): 4.907 s … 6.058 s 10 runs
Warning: Ignoring non-zero exit code.
Benchmark 3: pacman -Qk
Time (mean ± σ): 976.7 ms ± 5.0 ms [User: 101.9 ms, System: 873.5 ms]
Range (min … max): 970.3 ms … 984.6 ms 10 runs
Benchmark 4: pacman -Qkk
Time (mean ± σ): 86.467 s ± 0.160 s [User: 53.327 s, System: 16.404 s]
Range (min … max): 86.315 s … 86.819 s 10 runs
Warning: Ignoring non-zero exit code.
It appears that pacman -Qkk is much slower than paccheck --file-properties --sha256sum even. I don't know how that is possible!
The above benchmarks were executed on an AMD Ryzen 5600X with 32 GB RAM and an Gen3 NVME SSD. pacman -Syu executed as of yesterday most recently. Disk cache was hot in between runs for all the tools, that would make the first run a bit slower for all the tools (but not to a large extent on a SSD, I can imagine it would dominate on a mechanical HDD though)
In conclusion:
When checking just file properties paketkoll is 3.96 times faster than pacman checking just if the files exist
When checking checksums paketkoll is 16.3 times faster than pacman checking file properties. This is impressive on a 6 core/12 thread CPU. pacman must be doing something exceedingly stupid here (might be worth looking into, perhaps it is checking both sha256sum and md5sum, which is totally unneeded). Compared to paccheck I see a 7x speedup in that scenario which is more in line with what I would expect.