[Python-Dev] new buffer in python2.7 (original) (raw)

Stefan Behnel stefan_ml at behnel.de
Mon Nov 1 09:45:06 CET 2010


Kristján Valur Jónsson, 27.10.2010 16:28:

Notice how a Slice object is generated. Then a PyObjectGetItem() is done. The salient code path is from applyslice(). A slice object must be constructed and destroyed.

If slice object creation bothers you here, it might be worth using a free list in PySlice_New() instead of creating new slice objects on request.

Creating a slice of something is not necessarily such a costly operation that it dominates creating the slice object, so optimising the slice request itself sounds like a good idea.

You can take a look at how it's done in tupleoject.c if you want to provide a patch. Then, please open a bug tracker ticket and attach the patch there (and post a link to the ticket in this thread).

Stefan



More information about the Python-Dev mailing list