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 scoder
Recipients pitrou, scoder
Date 2013-08-23.06:31:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1377239513.48.0.47694430994.issue18813@psf.upfronthosting.co.za>
In-reply-to
Content
Here is another patch that remembers the Py_ssize_t slice indices if they are known at instantiation time. It only makes a very small difference for the "fannkuch" benchmark, so that's no reason to add both the complexity and the (IMHO ignorable) memory overhead.

However, it also adds a public C-API function PySlice_FromIndices() that allows setting the values from C code at instantiation time, thus avoiding the overhead of having to do the conversion back again.

It might also be worth exploring if we can't instantiate the Python object indices at first request using properties, iff the slice was created with integer indices. Meaning, we'd leave the PyObject* fields NULL in that case until they are being used. That would reduce the overhead of creating the slice object in the first place. Since we added the one-instance cache, it's now dominated by the creation of the index value objects when _PySlice_FromIndices() is being used internally (e.g. when calling PySequence_Get/Set/DelSlice()).
History
Date User Action Args
2013-08-23 06:31:53scodersetrecipients: + scoder, pitrou
2013-08-23 06:31:53scodersetmessageid: <1377239513.48.0.47694430994.issue18813@psf.upfronthosting.co.za>
2013-08-23 06:31:53scoderlinkissue18813 messages
2013-08-23 06:31:53scodercreate