[pacman-dev] [PATCH 0/2] Remove REQUIREDBY usage

Dan McGee dpmcgee at gmail.com
Tue Nov 13 00:28:33 EST 2007

On Nov 12, 2007 9:24 PM, Dan McGee <dpmcgee at gmail.com> wrote:
> On Nov 12, 2007 8:01 PM, Dan McGee <dpmcgee at gmail.com> wrote:
> > Some quick observations:
> > $ time pacman -Qt > /dev/null (pacman 3, latest GIT release)
> > real    0m0.084s
> > user    0m0.020s
> > sys     0m0.043s
> >
> > $ time ./src/pacman/pacman -Qt > /dev/null (with compute_requiredby switch)
> > real    0m1.893s
> > user    0m1.800s
> > sys     0m0.037s
> >
> > Obviously a slowdown, but is it all that bad in the big scheme of
> > things when corrupted requiredby entries no longer hurt us?
> I ran valgrind --tool=callgrind on the above command to see where our
> hotpoint is in the code, and it is quite clear- alpm_splitdeps takes
> almost 70% of the total time. That is wildly inefficient for such a
> small function, and that is after I even did a little optimization to
> it. So if we are looking to focus our energy on anything, it is this
> one function that needs it OR at least figuring out how we could
> better implement it. Perhaps we should split all the deps upon package
> loading instead? Considering I doubt their are 1.3 million dep entries
> in our DB (the amount of times alpm_splitdeps is called), this would
> really help if it is possible.

And continuing the trend of replying to myself, and showing why
optimizing the small little parts of code can  make a huge difference:
$ time pacman -Qt > /dev/null
real    0m0.089s
user    0m0.023s
sys     0m0.040s

$ time ./src/pacman/pacman -Qt > /dev/null
real    0m0.377s
user    0m0.277s
sys     0m0.063s

This is a 5x increase in speed by making the change I described above
in the previous email. I'll push a branch to my GIT repo tonight
detailing the changes.


More information about the pacman-dev mailing list