[Yum-devel] speeding up searchNevra in rpmsack
seth vidal
skvidal at linux.duke.edu
Thu Oct 12 04:19:45 UTC 2006
Hey folks,
I looked at ways of speeding up searchNevra in rpmsack and I started
testing them.
The shortest way I found was by creating a simple dict of
pkgtup == index_of_hdr_in_rpmdb
then we could simply look up the hdr by index and that would make
returning headers very efficient. That was written last night. It did,
in fact, result in a massive speed up for remove operations.
It also ended up knocking rpm over everytime.
If you want to see the cause try this:
import rpm
for num in range(1, 1000):
ts = rpm.TransactionSet()
print num
mi = ts.dbMatch(0, 20)
h = mi.next()
ts.closeDB()
del ts
The line:
mi = ts.dbMatch(0, 20) is the retrieval by index of a header. In this
case it is retrieving the header found at index 20.
Give that code a whirl, as root, inside a python or ipython interactive
shell. See if it causes a rather unceremonious exit. It does for me on
FC5.
The only way I could find to not make that happen when working on
searchNevra is to open a ts and keep it open. Which, of course, breaks
ctrl-c handling.
I just wanted to let people know that I have the code to speed up
searchNevra - I just can't put it in b/c it makes the world break.
-sv
More information about the Yum-devel
mailing list