3 ms·
I updated the benchmark [1] that I wrote to someone who responded to you to include a even/odd filter and take the minimum time of 100 runs. Python 3.13 is much
by tomtom1337 2y ago
I updated the benchmark [1] that I wrote to someone who responded to you to include a even/odd filter and take the minimum time of 100 runs. Python 3.13 is much faster for small lists, and a tiny bit faster for larger lists. The times are the time taken for iterating per entry in the list comprehension.
Running on Python 3.12.7 (main, Oct 2 2024, 15:45:55) [Clang 18.1.8 ]
16.69ns on N=100
18.84ns on N=1_000
15.88ns on N=10_000
14.26ns on N=100_000
14.70ns on N=1_000_000
Running on Python 3.13.0 (main, Oct 16 2024, 08:05:40) [Clang 18.1.8 ]
9.54ns on N=100
17.88ns on N=1_000
15.81ns on N=10_000
14.14ns on N=100_000
14.46ns on N=1_000_000
[1] https://gist.github.com/thomasaarholt/2e4d42cbf3f0de60c811bbf7a317c8fd https://gist.github.com/thomasaarholt/2e4d42cbf3f0de60c811bb...
- sgarland 2y agoFor simple loops, yes, I also found that 3.13 is roughly equivalent to 3.12. Both are much slower than 3.11, though [0] – roughly 6-9% for lists, and in one weird edge case, 57% slower for array.array, but only on MacOS (I only tested ARM, no idea on x86). Linux was about the same as for lists. [0]: https://github.com/python/cpython/issues/123540 https://github.com/python/cpython/issues/123540
- tomtom1337 2y agoThank you for sharing! I am convinced! Completely agree that this is a problem!