[Python-Dev] Optimizing list.sort() by checking type in advance (original) (raw)
Chris Angelico rosuav at gmail.com
Mon Oct 10 17:34:38 EDT 2016
- Previous message (by thread): [Python-Dev] Optimizing list.sort() by checking type in advance
- Next message (by thread): [Python-Dev] PyWeakref_GetObject() borrows its reference from... whom?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tue, Oct 11, 2016 at 7:42 AM, Elliot Gorokhovsky <elliot.gorokhovsky at gmail.com> wrote:
ChrisA suggested I also try "make test" or something to get a more realistic benchmark. I will do that once I implement this as a patch, right now it's an extension module that subclasses list, so I can't just drop it into existing code without modification.
Oh, okay. If it's done that way, there's (in a way) a guarantee that it won't worsen anything, because you have to explicitly request the new behaviour. So if you KNOW that you're going to be doing a ton of string-only sorting, you can call on this new list subclass, and if you're not, you simply don't.
ChrisA
- Previous message (by thread): [Python-Dev] Optimizing list.sort() by checking type in advance
- Next message (by thread): [Python-Dev] PyWeakref_GetObject() borrows its reference from... whom?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]