cpython/Objects
Tim Peters f2a0473350 docompare(): Use PyTuple_New instead of Py_BuildValue to build compare's
arg tuple.  This was suggested on c.l.py but afraid I can't find the msg
again for proper attribution.  For

    list.sort(cmp)

where list is a list of random ints, and cmp is __builtin__.cmp, this
yields an overall 50-60% speedup on my Win2K box.  Of course this is a
best case, because the overhead of calling cmp relative to the cost of
actually comparing two ints is at an extreme.  Nevertheless it's huge
bang for the buck.  An additionak 20-30% can be bought by making the arg
tuple an immortal static (avoiding all but "the first" PyTuple_New), but
that's tricky to make correct since docompare needs to be reentrant.  So
this picks the cherry and leaves the pits for Fred <wink>.

Note that this makes no difference to the

    list.sort()

case; an arg tuple gets built only if the user specifies an explicit
sort function.
2002-07-11 21:46:16 +00:00
..
.cvsignore
abstract.c Close SF bug 563740. complex() now finds __complex__() in new style classes. 2002-06-06 15:45:38 +00:00
boolobject.c Patch #568124: Add doc string macros. 2002-06-13 20:33:02 +00:00
bufferobject.c Fix SF bug 546434 -- buffer slice type inconsistent. 2002-06-25 00:25:30 +00:00
cellobject.c Use new GC API. 2001-08-29 23:54:21 +00:00
classobject.c object.h special-build macro minefield: renamed all the new lexical 2002-07-11 06:23:50 +00:00
cobject.c Patch #568124: Add doc string macros. 2002-06-13 20:33:02 +00:00
complexobject.c Patch #568124: Add doc string macros. 2002-06-13 20:33:02 +00:00
descrobject.c SF patch 568629 by Oren Tirosh: types made callable. 2002-06-14 20:41:17 +00:00
dictobject.c Patch #568124: Add doc string macros. 2002-06-13 20:33:02 +00:00
enumobject.c Patch #568124: Add doc string macros. 2002-06-13 20:33:02 +00:00
fileobject.c Patch #569753: Remove support for WIN16. 2002-06-30 15:26:10 +00:00
floatobject.c Patch #568124: Add doc string macros. 2002-06-13 20:33:02 +00:00
frameobject.c Fix SF bug #505315: Make free and cell vars show up consistently in locals(). 2002-04-20 04:46:55 +00:00
funcobject.c Extend function() to support an optional closure argument. 2002-07-11 18:30:27 +00:00
intobject.c Patch #568124: Add doc string macros. 2002-06-13 20:33:02 +00:00
iterobject.c SF 560736. Optimize list iteration by filling the tp_iter slot. 2002-05-31 21:40:38 +00:00
listobject.c docompare(): Use PyTuple_New instead of Py_BuildValue to build compare's 2002-07-11 21:46:16 +00:00
longobject.c Patch #568124: Add doc string macros. 2002-06-13 20:33:02 +00:00
methodobject.c Introduce two new flag bits that can be set in a PyMethodDef method 2002-03-28 05:33:33 +00:00
moduleobject.c Patch #568124: Add doc string macros. 2002-06-13 20:33:02 +00:00
object.c object.h special-build macro minefield: renamed all the new lexical 2002-07-11 06:23:50 +00:00
obmalloc.c Documented PYMALLOC_DEBUG. This completes primary coverage of all the 2002-07-10 19:29:49 +00:00
rangeobject.c Patch #568124: Add doc string macros. 2002-06-13 20:33:02 +00:00
sliceobject.c SF patch 568629 by Oren Tirosh: types made callable. 2002-06-14 20:41:17 +00:00
stringobject.c object.h special-build macro minefield: renamed all the new lexical 2002-07-11 06:23:50 +00:00
structseq.c Remove PyMalloc_New and PyMalloc_Del. 2002-04-12 03:05:37 +00:00
tupleobject.c object.h special-build macro minefield: renamed all the new lexical 2002-07-11 06:23:50 +00:00
typeobject.c object.h special-build macro minefield: renamed all the new lexical 2002-07-11 06:23:50 +00:00
unicodectype.c removed "register const" from scalar arguments to the unicode 2001-06-27 22:08:26 +00:00
unicodeobject.c Patch #569753: Remove support for WIN16. 2002-06-30 15:26:10 +00:00
unicodetype_db.h forgot to check in the new makeunicodedata.py script 2001-01-21 17:01:31 +00:00
weakrefobject.c Remove weakref free list. This has the side effect of fixing a memory 2002-03-27 15:18:21 +00:00
xxobject.c Use function instead of macro spellings for PyObject_memorystuff. 2002-05-23 15:51:20 +00:00