Author scoder
Recipients kristjan.jonsson, mark.dickinson, pitrou, scoder
Date 2011-02-02.18:48:34
SpamBayes Score 3.76543e-08
Marked as misclassified No
Message-id <>
> Any benchmark numbers for the slice cache?

I ran the list tests in pybench and got this:

Test               minimum run-time        average  run-time
                    this    other   diff    this    other   diff
    ListSlicing:    66ms    67ms   -2.2%    67ms    68ms   -2.7%
     SmallLists:    61ms    64ms   -4.5%    61ms    65ms   -5.6%
Totals:           127ms   131ms   -3.3%   128ms   133ms   -4.1%

Repeating this gave me anything between 1.5% and 3.5% in total, with >2% for the small lists benchmark (which is the expected best case as slicing large lists obviously dominates the slice object creation).

IMHO, even 2% would be pretty good for such a small change.

> Also, is the call to PyObject_INIT necessary?

In any case, the ref-count needs to be re-initialised to 1. A call to _Py_NewReference() would be enough, though, following the example in listobject.c. So you can replace

         PyObject_INIT(obj, &PySlice_Type);


         _Py_NewReference((PyObject *)obj);

in the patch. New patch attached.
Date User Action Args
2011-02-02 18:48:35scodersetrecipients: + scoder, mark.dickinson, pitrou, kristjan.jonsson
2011-02-02 18:48:35scodersetmessageid: <>
2011-02-02 18:48:34scoderlinkissue10227 messages
2011-02-02 18:48:34scodercreate