cpython/Objects
Andrew MacIntyre d57caed52c Performance of list([]) in 2.3 came up in a thread on comp.lang.python,
which can be reviewed via
http://coding.derkeiler.com/Archive/Python/comp.lang.python/2003-12/1011.html

Duncan Booth investigated, and discovered that an "optimisation" was
in fact a pessimisation for small numbers of elements in a source list,
compared to not having the optimisation, although with large numbers
of elements in the source list the optimisation was quite beneficial.

He posted his change to comp.lang.python (but not to SF).

Further research has confirmed his assessment that the optimisation only
becomes a net win when the source list has more than 100 elements.

I also found that the optimisation could apply to tuples as well,
but the gains only arrive with source tuples larger than about 320
elements and are nowhere near as significant as the gains with lists,
(~95% gain @ 10000 elements for lists, ~20% gain @ 10000 elements for
tuples) so I haven't proceeded with this.

The code as it was applied the optimisation to list subclasses as
well, and this also appears to be a net loss for all reasonable sized
sources (~80-100% for up to 100 elements, ~20% for more than 500
elements; I tested up to 10000 elements).

Duncan also suggested special casing empty lists, which I've extended
to all empty sequences.

On the basis that list_fill() is only ever called with a list for the
result argument, testing for the source being the destination has
now happens before testing source types.
2003-12-25 13:28:48 +00:00
..
.cvsignore Ignore a bunch of generated files. 2000-05-02 18:34:30 +00:00
abstract.c Fix Greg Ward's error message nit: PyObject_SetItem and PySequenceSetItem 2003-10-27 09:22:16 +00:00
boolobject.c - bool() called without arguments now returns False rather than 2003-04-19 18:15:10 +00:00
bufferobject.c Call me anal, but there was a particular phrase that was speading to 2002-08-19 19:26:42 +00:00
cellobject.c Use new GC API. 2001-08-29 23:54:21 +00:00
classobject.c - When method objects have an attribute that can be satisfied either 2003-11-22 23:55:50 +00:00
cobject.c Make CObjects mutable. Fixes #477441. 2003-10-19 18:30:01 +00:00
complexobject.c Simplify and speedup uses of Py_BuildValue(): 2003-10-12 19:09:37 +00:00
descrobject.c Use PyDict_Contains() instead of PySequence_Contains(). 2003-12-13 11:58:56 +00:00
dictnotes.txt Add notes on use cases with paired accesses to the same key. 2003-05-28 14:10:46 +00:00
dictobject.c Simplify previous checkin -- a new function was not needed. 2003-12-13 13:31:55 +00:00
enumobject.c Optimize reversed(list) using a custom iterator. 2003-11-07 15:38:09 +00:00
fileobject.c Getting rid of code dependent on GUSI or the MetroWerks compiler. 2003-11-19 22:52:23 +00:00
floatobject.c Getting rid of all the code inside #ifdef macintosh too. 2003-11-20 01:44:59 +00:00
frameobject.c Removing bogus Py_DECREF() reported by Armin Rigo (SF bug 812353). 2003-10-21 18:14:20 +00:00
funcobject.c SF bug #753451: classmethod abuse --> SystemError 2003-06-18 01:13:41 +00:00
intobject.c - Removed FutureWarnings related to hex/oct literals and conversions 2003-11-29 23:52:13 +00:00
iterobject.c Whitespace normalization. 2003-06-25 13:12:18 +00:00
listobject.c Performance of list([]) in 2.3 came up in a thread on comp.lang.python, 2003-12-25 13:28:48 +00:00
listsort.txt Fixed new typos, added a little info about ~sort versus "hint"s. 2002-08-10 07:04:01 +00:00
longobject.c SF patch 703666: Several objects don't decref tmp on failure in subtype_new 2003-06-28 20:04:25 +00:00
methodobject.c * Added a new method flag, METH_COEXIST. 2003-12-13 11:26:12 +00:00
moduleobject.c Remove code that tried to warn about shadowing builtin names after a 2003-07-16 22:04:11 +00:00
object.c Getting rid of all the code inside #ifdef macintosh too. 2003-11-20 01:44:59 +00:00
obmalloc.c Whitespace normalization. 2003-06-17 15:48:11 +00:00
rangeobject.c Implement and apply PEP 322, reverse iteration 2003-11-06 14:06:48 +00:00
setobject.c Speedup set.update by using the override mode for PyDict_Merge(). 2003-12-15 21:16:06 +00:00
sliceobject.c SF bug #800796: Difference between hash() and __hash__() 2003-09-05 14:27:30 +00:00
stringobject.c There are places in Python which assume bytes have 8-bits. Formalize that a 2003-12-22 16:31:41 +00:00
structseq.c Removed all uses of the out-of-favor __safe_for_unpickling__ magic 2003-02-01 02:16:37 +00:00
tupleobject.c Extended tuple's C API to include a new function, PyTuple_Pack() that is 2003-10-12 18:24:34 +00:00
typeobject.c Improve argument checking speed. 2003-12-13 15:21:55 +00:00
unicodectype.c Make lower/upper/title work for non-BMP characters. 2002-10-18 16:40:36 +00:00
unicodeobject.c Fix unicode.rsplit()'s bug that ignores separater on the end of string when 2003-12-23 09:10:16 +00:00
unicodetype_db.h Add unidata_version. Bump generator version number. 2002-11-25 09:13:37 +00:00
weakrefobject.c SF bug 839548: Bug in type's GC handling causes segfaults. 2003-11-20 21:21:46 +00:00