On Tue, 2010-08-24 at 18:28 -0400, David Malcolm wrote:
Profiling of a Fedora 14 "yum install *" showed it spending
80 seconds
out of 274 within its implementation of "str_eq" (24 million calls), so
optimizing this seems worthwhile.
(replying to self, sorry)
I added some instrumentation to my copy of yum/i18n.py:
str_eq_calls = {}
def str_eq(a, b):
""" convert between unicode and not and compare them, w/o warning or
being annoying"""
typesig = (type(a), type(b))
if typesig in str_eq_calls:
str_eq_calls[typesig] += 1
else:
str_eq_calls[typesig] = 1
(rest of function follows)
to capture the type signature of all of these calls, adding:
from yum.i18n import str_eq_calls
from pprint import pprint
pprint(str_eq_calls)
to yummain.py, to dump the stats on output.
The output indicates that in this case at least [1], all of the calls
are for the str vs str case:
{(<type 'str'>, <type 'str'>): 24274562}
So it seems to me to be worth optimizing for this case (24 million
calls, taking 29% of user time on a warm cache). I can try to cook
something up in .c or Cython, if this would be acceptable to the
yum/kitchen maintainers?
[snip]
Dave
[1] Fedora 14 x86_64, yum-3.2.27-19.fc14.noarch python-2.7-7.fc14.x86_64
"yum install *" on a test box inside RH's test lab with various test
repositories enabled