Message127746
| Author |
scoder |
| Recipients |
kristjan.jonsson, mark.dickinson, pitrou, scoder |
| Date |
2011年02月02日.18:48:34 |
| SpamBayes Score |
3.7654328e-08 |
| Marked as misclassified |
No |
| Message-id |
<1296672515.45.0.746065091536.issue10227@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
> 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);
by
_Py_NewReference((PyObject *)obj);
in the patch. New patch attached. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2011年02月02日 18:48:35 | scoder | set | recipients:
+ scoder, mark.dickinson, pitrou, kristjan.jonsson |
| 2011年02月02日 18:48:35 | scoder | set | messageid: <1296672515.45.0.746065091536.issue10227@psf.upfronthosting.co.za> |
| 2011年02月02日 18:48:34 | scoder | link | issue10227 messages |
| 2011年02月02日 18:48:34 | scoder | create |
|