This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author robin900
Recipients
Date 2001-04-06.20:06:03
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
The idea behind this patch:

>>> x = range(100) + [1,2,3] + range(90)

creates *five* list objects before binding the fifth 
list object to x. Four of the five objects are 
discarded. 

Or:

>>> x = range(100) + [2]

creates three list objects and discards two.

How can we make this more efficient?

The implementation overview:

When the Python VM POP()s two objects from the stack 
when doing a BINARY_* opcode, the frame owns one 
reference to each object. If the left operand object 
(second one popped) has a reference count of 1, then 
the object is only reachable by the VM in this frame. 
Since the VM will DECREF() the object after completing 
the binary operation and thus discard it, why not do 
the in-place version of the binary operation? This 
makes the above example more efficient (by making only 
three list objects and two list objects, respectively).

Any questions, mail me or post to python-list, where 
the patch and other discussion is present. The patch 
posted to python-list is against 2.1b1 release. On Mon 
Apr 09, I will create a cvs diff against current tree 
and upload here on Sourceforge.


History
Date User Action Args
2007-08-23 15:04:38adminlinkissue414391 messages
2007-08-23 15:04:38admincreate