[pacman-dev] [PATCH 0/2] Remove REQUIREDBY usage
Nagy Gabor
ngaba at bibl.u-szeged.hu
Tue Nov 13 08:05:27 EST 2007
Idézés Dan McGee <dpmcgee at gmail.com>:
> 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.
>
Hmm. Great job.
I'm a bit doubter about alpm_splitdep: did you empty disk cache before retest?
If you did so, this is really surprising to me: this is obviously a speed-up,
but that is _much_ greater than I expected.
Hmm.
http://projects.archlinux.org/git/?p=pacman.git;a=commit;h=7653bb93997f52848b54ab80868cd6da52808a75
we can spare the first strdup, if you backup *ptr then reset before return.
Some other suggestions:
1. compute_requiredby now can return with an alpm_list of pmpkg_t* -s, and then
we needn't scan pkgache to find 'pkgname' in deptest
2. -Qt needn't compute all the requiredby packages, it can stop if he find the
first requiredby (no orphan).
...
Summary: the results are very promising for me ;-)
Bye, ngaba
----------------------------------------------------
SZTE Egyetemi Könyvtár - http://www.bibl.u-szeged.hu
This mail sent through IMP: http://horde.org/imp/
More information about the pacman-dev
mailing list