I've already created a patch.  See http://bugs.python.org/issue10227.
I was working with 2.7 where slicing sequences is done differently than in 3.2, 
so the difference is not that very great.
I'm going to have another go at profiling the 3.2 version later and see why 
slicing a bytearray is so much more expensive than slicing a bytes object.
K

> -----Original Message-----
> From: python-dev-bounces+kristjan=ccpgames....@python.org
> [mailto:python-dev-bounces+kristjan=ccpgames....@python.org] On Behalf
> Of Stefan Behnel
> Sent: 1. nóvember 2010 16:45
> To: python-dev@python.org
> Subject: Re: [Python-Dev] new buffer in python2.7
> 
> Kristján Valur Jónsson, 27.10.2010 16:28:
> > Notice how  a Slice object is generated.  Then a PyObject_GetItem()
> is
> > done.  The salient code path is from apply_slice().  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
> 
> _______________________________________________
> Python-Dev mailing list
> Python-Dev@python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-
> dev/kristjan%40ccpgames.com
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to