[New-bugs-announce] [issue41732] Custom iterator to memoryview - performance improvement
Diogo Flores
report at bugs.python.org
Sun Sep 6 05:06:52 EDT 2020
New submission from Diogo Flores <dxflores at outlook.com>:
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
----------
messages: 376460
nosy: dxflores
priority: normal
severity: normal
status: open
title: Custom iterator to memoryview - performance improvement
versions: Python 3.10
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41732>
_______________________________________
More information about the New-bugs-announce
mailing list