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

Toshio Kuratomi a.badger at gmail.com
Fri Nov 16 18:25:13 UTC 2012


Meant to add -- and it looks like you have the other things well in hand.

ACK.

-Toshio

On Fri, Nov 16, 2012 at 10:19 AM, Toshio Kuratomi <a.badger at gmail.com> wrote:
>
> On Nov 16, 2012 9:17 AM, "Zdenek Pavlas" <zpavlas at redhat.com> wrote:
>>
>> Hi,
>>
>> > type checking is better done with isinstance
>>
>> isn't "type() is" significantly faster?
>>
> Interesting, it is.  I wan't aware of that.
>
> I suppose it depends on how widely you think this code will be used.  "type
> is" is an equality comparison. isinstance takes inheritance into account.
> So to be truly generic you'd want to use isinstance.  But since this is only
> likely to be used from yum related code trading for speed seems like a good
> idea.
>
>> > 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
>>
>> _______________________________________________
>> Yum-devel mailing list
>> Yum-devel at lists.baseurl.org
>> http://lists.baseurl.org/mailman/listinfo/yum-deve


More information about the Yum-devel mailing list