On 2014-09-15 23:10, Bernhard Voelker wrote:
So the question is if the pread()s could be enhanced/avoided.
I suppose that the entire database could be loaded in memory and then processed. This was not feasible 15 years ago, but now it is. Probably there are functions to map an entire file in RAM - I think that "map" is the current name. And it only needs to be loaded for some limited time. Or force the system to cache it by copying it to null... Look, it is as simple as this: cer@Telcontar:~> time cp /var/lib/rpm/Packages /dev/null real 0m3.560s user 0m0.003s sys 0m0.188s cer@Telcontar:~> time cp /var/lib/rpm/Name /dev/null real 0m0.067s user 0m0.000s sys 0m0.001s cer@Telcontar:~> time rpm -qa | wc -l 6154 real 0m3.191s user 0m2.685s sys 0m0.200s cer@Telcontar:~> It runs now in seconds, not minutes. -- Cheers / Saludos, Carlos E. R. (from 13.1 x86_64 "Bottle" at Telcontar)