Author dxflores
Recipients dxflores
Date 2020-09-06.09:06:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1599383212.96.0.797075491806.issue41732@roundup.psfhosted.org>
In-reply-to
Content
Hi,

Here's a patch that adds an iterator to memoryview, which makes iterating over memoryview objs considerably faster.

The following values result from a compilation with debug ON.

------------------------------------------------------------------------

Without patch:

cpython: ./python.exe -m timeit -s "a=memoryview(b'x'*1000000)" "for x in a: pass"
5 loops, best of 5: 98 msec per loop

cpython: ./python.exe -m timeit -s "a=b'x'*1000000" "for x in a: pass"
5 loops, best of 5: 68.6 msec per loop


With patch:

cpython: ./python.exe -m timeit -s "a=memoryview(b'x'*1000000)" "for x in a: pass"
5 loops, best of 5: 68.1 msec per loop

cpython: ./python.exe -m timeit -s "a=b'x'*1000000" "for x in a: pass"
5 loops, best of 5: 70 msec per loop

------------------------------------------------------------------------

Please let me know your thoughts regarding it.

Diogo
History
Date User Action Args
2020-09-06 09:06:52dxfloressetrecipients: + dxflores
2020-09-06 09:06:52dxfloressetmessageid: <1599383212.96.0.797075491806.issue41732@roundup.psfhosted.org>
2020-09-06 09:06:52dxfloreslinkissue41732 messages
2020-09-06 09:06:52dxflorescreate