Skip to content

Conversation

@kumaraditya303
Copy link
Contributor

@kumaraditya303 kumaraditya303 commented Dec 17, 2025

@kumaraditya303
Copy link
Contributor Author

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 loop

After:

./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

@markshannon
Copy link
Member

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 tuple/any/all optimization.

@kumaraditya303
Copy link
Contributor Author

can you benchmark this with small sequences, as those tend to more common.

Benchmark with smaller sequence:
Before:

./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 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants