Message376460
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 | |
| Date | User | Action | Args | | 2020-09-06 09:06:52 | dxflores | set | recipients: + dxflores | | 2020-09-06 09:06:52 | dxflores | set | messageid: <1599383212.96.0.797075491806.issue41732@roundup.psfhosted.org> | | 2020-09-06 09:06:52 | dxflores | link | issue41732 messages | | 2020-09-06 09:06:52 | dxflores | create | | |