4 ms·
Great minds think alike. Here's one I just cooked up. Python 3.13 is faster, at least for the simplest possible list comprehension with no filters. N is the len
by tomtom1337 2y ago
Great minds think alike. Here's one I just cooked up. Python 3.13 is faster, at least for the simplest possible list comprehension with no filters. N is the length of the list comprehension. Repeated 100 times for each test and showing the average. Run on a MacBook Air M3.
https://gist.github.com/thomasaarholt/2e4d42cbf3f0de60c811bbf7a317c8fd https://gist.github.com/thomasaarholt/2e4d42cbf3f0de60c811bb...
Running on Python 3.12.7 (main, Oct 2 2024, 15:45:55) [Clang 18.1.8 ]
11.32ns on N=100
9.42ns on N=1000
7.32ns on N=10000
5.23ns on N=100000
5.87ns on N=1000000
Running on Python 3.13.0 (main, Oct 16 2024, 08:05:40) [Clang 18.1.8 ]
7.30ns on N=100
5.91ns on N=1000
5.09ns on N=10000
4.31ns on N=100000
5.89ns on N=1000000