mirror of
https://github.com/python/cpython.git
synced 2025-12-23 09:19:18 +00:00
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.) |
||
|---|---|---|
| .. | ||
| abstract.h | ||
| bitset.h | ||
| boolobject.h | ||
| bufferobject.h | ||
| cellobject.h | ||
| ceval.h | ||
| classobject.h | ||
| cobject.h | ||
| codecs.h | ||
| compile.h | ||
| complexobject.h | ||
| cStringIO.h | ||
| datetime.h | ||
| descrobject.h | ||
| dictobject.h | ||
| enumobject.h | ||
| errcode.h | ||
| eval.h | ||
| fileobject.h | ||
| floatobject.h | ||
| frameobject.h | ||
| funcobject.h | ||
| graminit.h | ||
| grammar.h | ||
| import.h | ||
| intobject.h | ||
| intrcheck.h | ||
| iterobject.h | ||
| listobject.h | ||
| longintrepr.h | ||
| longobject.h | ||
| marshal.h | ||
| metagrammar.h | ||
| methodobject.h | ||
| modsupport.h | ||
| moduleobject.h | ||
| node.h | ||
| object.h | ||
| objimpl.h | ||
| opcode.h | ||
| osdefs.h | ||
| parsetok.h | ||
| patchlevel.h | ||
| pgen.h | ||
| pgenheaders.h | ||
| py_curses.h | ||
| pydebug.h | ||
| pyerrors.h | ||
| pyfpe.h | ||
| pygetopt.h | ||
| pymactoolbox.h | ||
| pymem.h | ||
| pyport.h | ||
| pystate.h | ||
| Python.h | ||
| pythonrun.h | ||
| pythread.h | ||
| rangeobject.h | ||
| setobject.h | ||
| sliceobject.h | ||
| stringobject.h | ||
| structmember.h | ||
| structseq.h | ||
| symtable.h | ||
| sysmodule.h | ||
| token.h | ||
| traceback.h | ||
| tupleobject.h | ||
| ucnhash.h | ||
| unicodeobject.h | ||
| weakrefobject.h | ||