On 3/12/2011 5:09 PM, Reid Kleckner wrote:
On Sat, Mar 12, 2011 at 4:58 PM, Nick Coghlan<ncogh...@gmail.com>  wrote:
On Sat, Mar 12, 2011 at 4:50 PM, Reid Kleckner<reid.kleck...@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

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to