On 3/12/2011 5:09 PM, Reid Kleckner wrote: > On Sat, Mar 12, 2011 at 4:58 PM, Nick Coghlan<ncoghlan at gmail.com> wrote: >> On Sat, Mar 12, 2011 at 4:50 PM, Reid Kleckner<reid.kleckner at gmail.com> wrote: >>> They should be able to use a slotted cmp_to_key style class: >>> http://docs.python.org/howto/sorting.html >>> >>> That will allocate 1 Python object with no dict per key, but that >>> might not be good enough. >> >> Tuples are already slotted, so that isn't likely to help in this case. > > It's three allocations vs. one. The first is tuple + str + int, while > the adapter is just one object. I'm not sure how it eventually shakes > out, though. > > That said, it's still worse than Python 2, which is zero allocations. :) And revising the data so that no key and no cmp function is needed is zero allocations and faster. See my other post. -- Terry Jan Reedy
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4