why doesn't yum cache anything?
Mitch Skinner
lists at arctur.us
Fri Dec 31 15:15:57 UTC 2004
A sample profile of a yum -C list command from my machine (1.4GHz, 1GB
RAM):
223695 function calls (223189 primitive calls) in 14.600 CPU
seconds
Ordered by: internal time
List reduced from 358 to 20 due to restriction <20>
ncalls tottime percall cumtime percall filename:lineno(function)
4 2.150 0.538 2.150 0.538 mdcache.py:58(_unpickle)
1 1.680 1.680 3.680 3.680 packageSack.py:168
(buildIndexes)
83615 1.680 0.000 1.680 0.000 packageSack.py:136
(_addToDictAsList)
3485 1.650 0.000 1.650 0.000 packages.py:402
(importFromDict)
8149 0.910 0.000 1.390 0.000 packageObject.py:50
(returnNevraTuple)
1 0.790 0.790 0.810 0.810 __init__.py:59(addDB)
3485 0.780 0.000 2.820 0.001 packages.py:305(__init__)
3485 0.770 0.000 0.770 0.000 output.py:43
(simpleProgressBar)
68424 0.730 0.000 0.730 0.000 packageObject.py:36
(returnSimple)
1 0.720 0.720 0.720 0.720 __init__.py:88(getHdrList)
1 0.340 0.340 13.860 13.860 __init__.py:598
(doPackageLists)
4 0.300 0.075 5.230 1.307 repos.py:40(addDict)
6090 0.290 0.000 0.290 0.000 packages.py:194(tagByName)
3485 0.280 0.000 1.220 0.000 packageSack.py:155
(addPackage)
3485 0.150 0.000 0.150 0.000 packageObject.py:207
(__init__)
1015 0.100 0.000 0.410 0.000 packages.py:173(__init__)
6996 0.100 0.000 0.100 0.000 packageObject.py:290
(returnFileEntries)
2114 0.100 0.000 0.200 0.000 sre.py:177(compile)
1 0.100 0.100 7.500 7.500 repos.py:164(populateSack)
2 0.090 0.045 0.090 0.045 packages.py:34
(buildPkgRefDict)
The profile was produced by the bit of python below. It looks like the
biggest user is _unpickle in mdcache.py, which just calls python's
built-in deserialization that's implemented in C (cPickle), which is
about as close as it gets to pure caching, I think.
I notice that the following two lines are taking up a fair chunk of
time:
1 1.680 1.680 3.680 3.680 packageSack.py:168
(buildIndexes)
83615 1.680 0.000 1.680 0.000 packageSack.py:136
(_addToDictAsList)
and it looks like they're (only?) used in dependency solving; could we
leave that work out of commands like list and search?
Certainly, depsolving is a lot faster than it used to be, and I think
the indexing is great if it speeds that up; I just wish I didn't have to
wait for it when I don't need to depsolve.
Mitch
import sys
sys.path.insert(0, '/usr/share/yum-cli')
import yummain
import profile
import pstats
p = profile.Profile()
try:
p.run('yummain.main(["-C", "list", "*mtr*"])')
except SystemExit, e:
pass
pst = pstats.Stats(p)
pst.strip_dirs().sort_stats('time').print_stats(20)
More information about the fedora-devel-list
mailing list