[Yum-devel] [PATCH] clean up misc.to_xml(), make it faster, add tests. BZ 716235.

Zdenek Pavlas zpavlas at redhat.com
Fri Nov 16 17:17:50 UTC 2012


Hi,

> type checking is better done with isinstance

isn't "type() is" significantly faster?

> unicode('item', 'utf-8') was a runaway winner.

Didn't know that, Thanks!

> Should probably have a final else: clause here.  It can be as simple
> as throwing an TypeError exception

Yes, that would be nice..

> item = item.replace("'", ''')

Seems to be a good idea.

> replacing and killing of bad bytes with a single call to item.translate()

Tried that, too. unicode.replace(dict) is surprisingly slow.
With the same test case, this scored some 0.180s



More information about the Yum-devel mailing list