[Python-checkins] python/dist/src/Misc NEWS,1.934,1.935

rhettinger at users.sourceforge.net rhettinger at users.sourceforge.net
Sat Feb 14 23:06:44 EST 2004


Update of /cvsroot/python/python/dist/src/Misc
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4496

Modified Files:
	NEWS 
Log Message:
* Moved the responsibility for emptying the previous list from list_fill
  to list_init.

* Replaced the code in list_extend with the superior code from list_fill.

* Eliminated list_fill.

Results:

* list.extend() no longer creates an intermediate tuple except to handle
  the special case of x.extend(x).  The saves memory and time.

* list.extend(x) runs
    about the same x is a list or tuple,
    a little faster when x is an iterable not defining __len__, and
    twice as fast when x is an iterable defining __len__.
    
* the code is about 15 lines shorter and no longer duplicates
  functionality.



Index: NEWS
===================================================================
RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v
retrieving revision 1.934
retrieving revision 1.935
diff -C2 -d -r1.934 -r1.935
*** NEWS	14 Feb 2004 18:34:46 -0000	1.934
--- NEWS	15 Feb 2004 04:06:39 -0000	1.935
***************
*** 13,16 ****
--- 13,21 ----
  -----------------
  
+ - Optimized list.extend() to save memory and no longer create
+   intermediate sequences.  Also, extend() now pre-allocates the
+   needed memory whenever the length of the iterable is known in
+   advance -- this halves the time to extend the list.
+ 
  - Optimized list resize operations to make fewer calls to the system
    realloc().  Significantly speeds up list appends, list pops,




More information about the Python-checkins mailing list