[issue10227] Improve performance of MemoryView slicing
Antoine Pitrou
report at bugs.python.org
Wed Feb 2 19:54:17 CET 2011
Antoine Pitrou <pitrou at free.fr> added the comment:
> 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.
Well, 3% on such micro-benchmarks (and, I assume, 0% on the rest) is
generally considered very small.
On the other hand, I agree the patch itself is quite simple.
> by
>
> _Py_NewReference((PyObject *)obj);
>
> in the patch. New patch attached.
Don't you also need a _Py_ForgetReference() at the other end? Or have I
missed it?
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10227>
_______________________________________
More information about the Python-bugs-list
mailing list