-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
Custom iterator to memoryview - performance improvement #85898
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
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" cpython: ./python.exe -m timeit -s "a=b'x'*1000000" "for x in a: pass" With patch: cpython: ./python.exe -m timeit -s "a=memoryview(b'x'*1000000)" "for x in a: pass" cpython: ./python.exe -m timeit -s "a=b'x'*1000000" "for x in a: pass" ------------------------------------------------------------------------ Please let me know your thoughts regarding it. Diogo |
It would have been nice to have had a chance to look at this, but |
Thanks, Diogo for working on this issue. |
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. |
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. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: