New submission from Diogo Flores <dxflo...@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 <rep...@bugs.python.org> <https://bugs.python.org/issue41732> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com