You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Custom iterator to memoryview - performance improvement #85898
Stefan Krah: "It would have been nice to have had a chance to look at this, but apparently those days are over."
The PR has been approved by two core developers. It's a nice optimization, I don't see what is the problem here.
dxflores commented on Sep 8, 2020
dxfloresmannequin
MannequinAuthor
More actions
Thank you Dong-hee Na and Victor.
@Stefan Krah: I am sorry that you didn't had the chace to try out the patch before it got merged, however iff you are curious about the any aspect of the implementation (or the motivation behind it) I am happy to discuss it in depth.
Activity
dxflores commentedon Sep 6, 2020
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
corona10 commentedon Sep 8, 2020
New changeset b0ac5d7 by dxflores in branch 'master':
bpo-41732: add iterator to memoryview (GH-22119)
b0ac5d7
skrah commentedon Sep 8, 2020
It would have been nice to have had a chance to look at this, but
apparently those days are over.
corona10 commentedon Sep 8, 2020
Thanks, Diogo for working on this issue.
And thank you for the mentoring guido!
vstinner commentedon Sep 8, 2020
Thanks Diogo Flores, it's a nice optimization!
Stefan Krah: "It would have been nice to have had a chance to look at this, but apparently those days are over."
The PR has been approved by two core developers. It's a nice optimization, I don't see what is the problem here.
dxflores commentedon Sep 8, 2020
Thank you Dong-hee Na and Victor.
@Stefan Krah: I am sorry that you didn't had the chace to try out the patch before it got merged, however iff you are curious about the any aspect of the implementation (or the motivation behind it) I am happy to discuss it in depth.