-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
gh-142863: optimize list and set calls with generator expressions #142864
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
Conversation
|
Benchmark results: Before: ❯ ./python.exe -m timeit "list(x for x in range(10000))"
2000 loops, best of 5: 188 usec per loop
❯ ./python.exe -m timeit "set(x for x in range(10000))"
1000 loops, best of 5: 226 usec per loopAfter: ❯ ./python.exe -m timeit "list(x for x in range(10000))"
2000 loops, best of 5: 150 usec per loop
❯ ./python.exe -m timeit "set(x for x in range(10000))"
2000 loops, best of 5: 178 usec per loop |
|
This looks promising. @kumaraditya303 can you benchmark this with small sequences, as those tend to more common. @iritkatriel could you take a look, as author of the |
Benchmark with smaller sequence: ❯ ./python.exe -m timeit "list(x for x in range(25))"
500000 loops, best of 5: 483 nsec per loop
After: ❯ ./python.exe -m timeit "list(x for x in range(25))"
500000 loops, best of 5: 390 nsec per loop |
|
@markshannon I have fixed the merge conflicts, can you review this? |
markshannon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thanks.
Uh oh!
There was an error while loading. Please reload this page.