str_eq within yum (and kitchen)
by David Malcolm
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.
One possibility is to hand-optimize this in C, or use Cython.
As a first step, attached are some more selftests for kitchen's [1]
implementation of this function, to try to better capture some of the
expected behavior.
What's the expected behavior, if any, of passing in objects that aren't
str or unicode?
e.g. passing in a float
>>> str_eq(0.1, 0.1)
True
Is it acceptable if, say it, raises a TypeError instead?
Do you need support for objects that are derived from str/unicode as
well as those specific classes?
Hope this is helpful
Dave
[1] https://fedorahosted.org/kitchen/
13 years, 8 months