cpython/Include
Raymond Hettinger 4bb9540dd6 * Optimized list appends and pops by making fewer calls the underlying system
realloc().  This is achieved by tracking the overallocation size in a new
  field and using that information to skip calls to realloc() whenever
  possible.

* Simplified and tightened the amount of overallocation.  For larger lists,
  this overallocates by 1/8th (compared to the previous scheme which ranged
  between 1/4th to 1/32nd over-allocation).  For smaller lists (n<6), the
  maximum overallocation is one byte (formerly it could be upto eight bytes).
  This saves memory in applications with large numbers of small lists.

* Eliminated the NRESIZE macro in favor of a new, static list_resize function
  that encapsulates the resizing logic.  Coverting this back to macro would
  give a small (under 1%) speed-up.  This was too small to warrant the loss
  of readability, maintainability, and de-coupling.

* Some functions using NRESIZE had grown unnecessarily complex in their
  efforts to bend to the macro's calling pattern.  With the new list_resize
  function in place, those other functions could be simplified.  That is
  being saved for a separate patch.

* The ob_item==NULL check could be eliminated from the new list_resize
  function.  This would entail finding each piece of code that sets ob_item
  to NULL and adding a new line to invalidate the overallocation tracking
  field.  Rather than impose a new requirement on other pieces of list code,
  it was preferred to leave the NULL check in place and retain the benefits
  of decoupling, maintainability and information hiding (only PyList_New()
  and list_sort() need to know about the new field).  This approach also
  reduces the odds of breaking an extension module.

(Collaborative effort by Raymond Hettinger, Hye-Shik Chang, Tim Peters,
 and Armin Rigo.)
2004-02-13 11:36:39 +00:00
..
Python.h remove support for missing ANSI C header files (limits.h, stddef.h, etc). 2004-02-10 16:50:21 +00:00
abstract.h Fix a bunch of typos in documentation, docstrings and comments. 2003-10-20 14:01:56 +00:00
bitset.h REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
boolobject.h Modify the Py_RETURN_* macros to be of the form ``do {...} while (0)`` in order 2003-10-19 22:58:11 +00:00
bufferobject.h Excise DL_EXPORT from Include. 2002-08-12 07:21:58 +00:00
cStringIO.h SF bug #670229: doc improvement for cStringIO.h 2003-01-19 00:45:01 +00:00
cellobject.h Excise DL_EXPORT from Include. 2002-08-12 07:21:58 +00:00
ceval.h Deleting cyclic object comparison. 2003-10-28 12:05:48 +00:00
classobject.h Typo repair. 2003-04-08 18:47:21 +00:00
cobject.h Make CObjects mutable. Fixes #477441. 2003-10-19 18:30:01 +00:00
codecs.h PEP 293 implemention (from SF patch http://www.python.org/sf/432401) 2002-09-02 13:14:32 +00:00
compile.h This is my patch #876198 plus a NEWS entry and a header frob. 2004-02-12 15:28:27 +00:00
complexobject.h SF # 607253, header file problems by Ralf W. Grosse-Kunstleve 2002-10-04 12:43:02 +00:00
datetime.h Got rid of the internal datetimetz type. 2003-01-11 03:39:11 +00:00
descrobject.h SF 548651: Fix the METH_CLASS implementation. 2002-12-09 22:56:13 +00:00
dictobject.h Fix name problem in previous checkin: Dict not List 2003-12-26 17:17:49 +00:00
enumobject.h Implement and apply PEP 322, reverse iteration 2003-11-06 14:06:48 +00:00
errcode.h provide less mysterious error messages when seeing end-of-line in 2002-08-15 01:20:16 +00:00
eval.h - New function sys.call_tracing() allows pdb to debug code 2003-04-09 19:06:21 +00:00
fileobject.h Remove support for --without-universal-newlines (see PEP 11). 2004-02-07 13:53:46 +00:00
floatobject.h New private API functions _PyFloat_{Pack,Unpack}(4,8}. This is a 2003-03-20 20:53:32 +00:00
frameobject.h A slight change to SET_LINENO-less tracing. 2002-09-11 15:36:32 +00:00
funcobject.h Provide __module__ attributes for functions defined in C and Python. 2003-01-31 18:33:18 +00:00
graminit.h Patch #534304: Implement phase 1 of PEP 263. 2002-08-04 17:29:52 +00:00
grammar.h REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
import.h Excise DL_IMPORT/EXPORT from object.h, and related files. This patch 2002-07-29 13:42:14 +00:00
intobject.h SF # 595026: support for masks in getargs.c. 2003-04-17 18:55:45 +00:00
intrcheck.h Excise DL_EXPORT from Include. 2002-08-12 07:21:58 +00:00
iterobject.h Excise DL_EXPORT from Include. 2002-08-12 07:21:58 +00:00
listobject.h * Optimized list appends and pops by making fewer calls the underlying system 2004-02-13 11:36:39 +00:00
longintrepr.h Excise DL_EXPORT from Include. 2002-08-12 07:21:58 +00:00
longobject.h SF # 595026: support for masks in getargs.c. 2003-04-17 18:55:45 +00:00
marshal.h Fix SF bug #697256, PyMarshal_WriteShortToFile() documented, but not implemented 2003-03-06 22:04:24 +00:00
metagrammar.h REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
methodobject.h * Added a new method flag, METH_COEXIST. 2003-12-13 11:26:12 +00:00
modsupport.h SF patch 576101, by Oren Tirosh: alternative implementation of 2002-08-19 21:43:18 +00:00
moduleobject.h Excise DL_EXPORT from Include. 2002-08-12 07:21:58 +00:00
node.h Back out the previous change. It doesn't save any space on 64-bit 2002-09-17 03:27:02 +00:00
object.h fixed buggy comment as per SF bug #827856 2003-11-09 16:38:39 +00:00
objimpl.h - New C API PyGC_Collect(), same as calling gc.collect(). 2003-04-17 17:29:22 +00:00
opcode.h Revert the previous enhancement to the bytecode optimizer. 2003-04-24 05:45:23 +00:00
osdefs.h Getting rid of all the code inside #ifdef macintosh too. 2003-11-20 01:44:59 +00:00
parsetok.h Changes from Jonathan Riehl to allow his pgen extension (PEP 269) to 2003-04-17 14:55:42 +00:00
patchlevel.h Bump the trunk to 2.4a0 2003-07-30 05:37:39 +00:00
pgen.h Changes from Jonathan Riehl to allow his pgen extension (PEP 269) to 2003-04-17 14:55:42 +00:00
pgenheaders.h Use Py_GCC_ATTRIBUTE instead of __attribute__. Compilers other than GCC 2002-09-15 14:09:54 +00:00
py_curses.h FreeBSD 5.x uses different wchar_t/win_t guards than earlier versions 2003-06-29 15:46:21 +00:00
pydebug.h Update comment, QnewFlag will go away in 3.0, not 2.3 2003-01-13 16:08:56 +00:00
pyerrors.h Use appropriate macros not the deprecated DL_IMPORT/DL_EXPORT macros 2003-07-01 20:15:21 +00:00
pyfpe.h
pygetopt.h Excise DL_EXPORT from Include. 2002-08-12 07:21:58 +00:00
pymactoolbox.h Got rid of macglue.h, moved the little bit that remains relevant 2003-11-20 13:28:19 +00:00
pymem.h Remove MALLOC_ZERO_RETURNS_NULL. 2002-11-23 09:13:40 +00:00
pyport.h remove support for missing ANSI C header files (limits.h, stddef.h, etc). 2004-02-10 16:50:21 +00:00
pystate.h Add PyThreadState_SetAsyncExc(long, PyObject *). 2003-06-28 21:53:52 +00:00
pythonrun.h - Finally fixed the bug in compile() and exec where a string ending 2003-02-13 22:07:59 +00:00
pythread.h New PyGILState_ API - implements pep 311, from patch 684256. 2003-04-19 15:41:53 +00:00
rangeobject.h Excise DL_EXPORT from Include. 2002-08-12 07:21:58 +00:00
setobject.h * Checkin remaining documentation 2003-11-24 02:57:33 +00:00
sliceobject.h Excise DL_EXPORT from Include. 2002-08-12 07:21:58 +00:00
stringobject.h Use appropriate macros not the deprecated DL_IMPORT/DL_EXPORT macros 2003-07-01 20:15:21 +00:00
structmember.h remove support for missing ANSI C header files (limits.h, stddef.h, etc). 2004-02-10 16:50:21 +00:00
structseq.h Clean up some whitespace to be consistent with Python's C style. 2002-10-17 19:48:27 +00:00
symtable.h Fix for SF [ 734869 ] Lambda functions in list comprehensions 2003-05-21 17:34:50 +00:00
sysmodule.h Use Py_GCC_ATTRIBUTE instead of __attribute__. Compilers other than GCC 2002-09-15 14:09:54 +00:00
token.h Excise DL_EXPORT from Include. 2002-08-12 07:21:58 +00:00
traceback.h Excise DL_EXPORT from Include. 2002-08-12 07:21:58 +00:00
tupleobject.h Extended tuple's C API to include a new function, PyTuple_Pack() that is 2003-10-12 18:24:34 +00:00
ucnhash.h refactored the unicodeobject/ucnhash interface, to hide the 2001-01-19 09:45:02 +00:00
unicodeobject.h Add rsplit method for str and unicode builtin types. 2003-12-15 18:49:53 +00:00
weakrefobject.h SF bug 839548: Bug in type's GC handling causes segfaults. 2003-11-20 21:21:46 +00:00