Python 3.10 vs Python 3.11 – performance testing

This article describes the performance testing results of Python 3.11 compared to Python 3.10. A total of 87 various benchmark tests were conducted on computers with the AMD Ryzen 7000 series and the 13th-generation of Intel Core processors for desktops, laptops or mini PCs.

All tests were run on Windows 11 computers using the pyperformance 1.0.9 library in Python 3.10.11 and Python 3.11.6 (both 64-bit versions).

AMD Ryzen 7000 Series Desktop Processor

The first part of testing involved a desktop computer with an AMD Ryzen 9 7900 processor, RAM DDR5, and an M.2 PCIe Gen4 NVMe drive. The table below shows the results of 87 tests performed using Python 3.10 (as a reference) and Python 3.11 on this device.

Benchmark Python 3.10 Python 3.11
2to3 216 ms 191 ms (1.13x faster)
async_generators 230 ms 198 ms (1.16x faster)
async_tree_cpu_io_mixed 685 ms 580 ms (1.18x faster)
async_tree_io 1.32 sec 949 ms (1.39x faster)
async_tree_memoization 560 ms 420 ms (1.33x faster)
async_tree_none 471 ms 340 ms (1.39x faster)
asyncio_tcp 686 ms 708 ms (not significant)
asyncio_tcp_ssl 2.04 sec 2.02 sec (not significant)
bench_mp_pool 55.4 ms 54.9 ms (1.01x faster)
bench_thread_pool 725 us 687 us (1.05x faster)
chameleon 5.89 ms 5.23 ms (1.13x faster)
chaos 57.1 ms 45.7 ms (1.25x faster)
comprehensions 14.6 us 14.4 us (1.02x faster)
coroutines 17.3 ms 16.9 ms (1.02x faster)
coverage 33.5 ms 141 ms (4.21x slower)
create_gc_cycles 637 us 521 us (1.22x faster)
crypto_pyaes 62.7 ms 48.3 ms (1.30x faster)
dask 263 ms 235 ms (1.12x faster)
deepcopy 253 us 225 us (1.12x faster)
deepcopy_memo 28.9 us 25.1 us (1.15x faster)
deepcopy_reduce 2.20 us 2.02 us (1.09x faster)
deltablue 4.27 ms 2.63 ms (1.63x faster)
django_template 28.2 ms 23.0 ms (1.22x faster)
docutils 1.63 sec 1.39 sec (1.18x faster)
fannkuch 256 ms 240 ms (1.07x faster)
float 66.7 ms 53.5 ms (1.25x faster)
gc_traversal 1.20 ms 1.25 ms (1.04x slower)
generators 41.8 ms 41.0 ms (not significant)
genshi_text 18.7 ms 16.6 ms (1.13x faster)
genshi_xml 132 ms 95.9 ms (1.07x faster)
hexiom 5.46 ms 4.39 ms (1.25x faster)
html5lib 39.3 ms 31.2 ms (1.26x faster)
json_dumps 8.09 ms 7.72 ms (1.05x faster)
json_loads 13.3 us 12.7 us (1.05x faster)
logging_format 6.74 us 6.35 us (1.06x faster)
logging_silent 102 ns 71.6 ns (1.43x faster)
logging_simple 6.36 us 6.00 us (1.06x faster)
mako 9.04 ms 7.49 ms (1.21x faster)
mdp 1.68 sec 1.62 sec (1.04x faster)
meteor_contest 65.9 ms 65.9 ms (not significant)
nbody 81.8 ms 73.6 ms (1.11x faster)
nqueens 61.3 ms 60.3 ms (not significant)
pathlib 81.3 ms 79.9 ms (1.02x faster)
pickle 6.86 us 6.66 us (1.03x faster)
pickle_dict 18.5 us 18.3 us (1.01x faster)
pickle_list 2.58 us 2.59 us (not significant)
pickle_pure_python 258 us 191 us (1.35x faster)
pidigits 136 ms 136 ms (not significant)
pprint_pformat 1.17 sec 983 ms (1.19x faster)
pprint_safe_repr 568 ms 479 ms (1.19x faster)
pyflate 387 ms 293 ms (1.32x faster)
python_startup 17.4 ms 15.2 ms (1.15x faster)
python_startup_no_site 13.2 ms 12.5 ms (1.05x faster)
raytrace 275 ms 204 ms (1.35x faster)
regex_compile 89.5 ms 77.1 ms (1.16x faster)
regex_dna 111 ms 103 ms (1.07x faster)
regex_effbot 1.78 ms 1.64 ms (1.09x faster)
regex_v8 15.0 ms 14.7 ms (1.02x faster)
richards 41.7 ms 29.8 ms (1.40x faster)
richards_super 50.9 ms 37.0 ms (1.37x faster)
scimark_fft 223 ms 214 ms (1.04x faster)
scimark_lu 94.3 ms 68.7 ms (1.37x faster)
scimark_monte_carlo 58.1 ms 44.2 ms (1.32x faster)
scimark_sor 105 ms 80.4 ms (1.30x faster)
scimark_sparse_mat_mult 3.47 ms 3.29 ms (1.05x faster)
spectral_norm 82.1 ms 75.7 ms (1.08x faster)
sqlglot_normalize 198 ms 178 ms (1.11x faster)
sqlglot_optimize 37.1 ms 32.3 ms (1.15x faster)
sqlglot_parse 1.12 ms 891 us (1.26x faster)
sqlglot_transpile 1.33 ms 1.06 ms (1.25x faster)
sqlite_synth 1.54 us 1.41 us (1.09x faster)
sympy_expand 265 ms 248 ms (1.07x faster)
sympy_integrate 12.7 ms 11.8 ms (1.07x faster)
sympy_str 162 ms 152 ms (1.06x faster)
sympy_sum 91.4 ms 86.4 ms (1.06x faster)
telco 3.80 ms 3.91 ms (1.03x slower)
tomli_loads 1.69 sec 1.46 sec (1.15x faster)
tornado_http 98.2 ms 86.9 ms (1.13x faster)
typing_runtime_protocols 314 us 307 us (1.02x faster)
unpack_sequence 39.3 ns 35.1 ns (1.12x faster)
unpickle 8.59 us 8.13 us (1.06x faster)
unpickle_list 2.87 us 2.86 us (not significant)
unpickle_pure_python 176 us 150 us (1.18x faster)
xml_etree_generate 55.2 ms 53.6 ms (1.03x faster)
xml_etree_iterparse 57.6 ms 60.0 ms (1.04x slower)
xml_etree_parse 83.4 ms 82.3 ms (1.01x faster)
xml_etree_process 44.4 ms 38.4 ms (1.16x faster)
Result (geometric mean) 1.11x faster

The result shows that Python 3.11 has the best performance results over Python 3.10 in the following tests: deltablue (1.63x faster), logging_silent (1.43x faster), richards (1.40x faster). However, you may notice a drop in performance in some tests, especially in coverage (4.21x slower), sqlglot_parse (1.26x faster), gc_traversal (1.04x slower).

Additionally, you can examine the performance differences between Python 3.11 and Python 3.10 based on benchmarks belonging to specific groups. The table below shows the geometric mean for benchmarks from separate groups for Python 3.11 compared to Python 3.10.

Group of benchmarks Python 3.11 to Python 3.10
apps 1.16x faster
asyncio 1.32x faster
math 1.12x faster
regex 1.08x faster
serialize 1.07x faster
startup 1.10x faster
template 1.16x faster

13th Gen Intel Core Mobile Processor

The second part of testing involved a mini PC with an Intel Core i3-1315U Processor (which is also used in laptops), RAM DDR4, and an M.2 PCIe Gen4 NVMe drive. The table below shows the results of 87 tests performed using Python 3.10 (as a reference) and Python 3.11 on this device.

Benchmark Python 3.10 Python 3.11
2to3 282 ms 250 ms (1.13x faster)
async_generators 254 ms 208 ms (1.22x faster)
async_tree_cpu_io_mixed 716 ms 615 ms (1.16x faster)
async_tree_io 1.16 sec 864 ms (1.34x faster)
async_tree_memoization 593 ms 463 ms (1.28x faster)
async_tree_none 486 ms 373 ms (1.30x faster)
asyncio_tcp 981 ms 966 ms (not significant)
asyncio_tcp_ssl 2.43 sec 3.22 sec (1.33x slower)
bench_mp_pool 89.5 ms 87.2 ms (1.03x faster)
bench_thread_pool 1.24 ms 1.13 ms (1.09x faster)
chameleon 6.47 ms 6.01 ms (1.08x faster)
chaos 68.8 ms 55.7 ms (1.24x faster)
comprehensions 18.4 us 18.4 us (not significant)
coroutines 18.0 ms 16.8 ms (1.07x faster)
coverage 33.0 ms 163 ms (4.95x slower)
create_gc_cycles 888 us 799 us (1.11x faster)
crypto_pyaes 70.3 ms 54.9 ms (1.28x faster)
dask 431 ms 379 ms (1.14x faster)
deepcopy 293 us 282 us (1.04x faster)
deepcopy_memo 32.0 us 28.9 us (1.11x faster)
deepcopy_reduce 2.47 us 2.35 us (1.05x faster)
deltablue 4.71 ms 3.02 ms (1.56x faster)
django_template 33.3 ms 27.6 ms (1.21x faster)
docutils 2.19 sec 1.86 sec (1.18x faster)
fannkuch 306 ms 283 ms (1.08x faster)
float 70.0 ms 62.2 ms (1.13x faster)
gc_traversal 1.69 ms 1.80 ms (1.07x slower)
generators 36.0 ms 38.2 ms (1.06x slower)
genshi_text 21.6 ms 19.5 ms (1.11x faster)
genshi_xml 153 ms 118 ms (1.05x faster)
hexiom 6.22 ms 5.19 ms (1.20x faster)
html5lib 56.0 ms 45.5 ms (1.23x faster)
json_dumps 9.76 ms 8.76 ms (1.11x faster)
json_loads 16.0 us 16.3 us (1.02x slower)
logging_format 8.15 us 7.67 us (1.06x faster)
logging_silent 106 ns 81.4 ns (1.30x faster)
logging_simple 7.60 us 7.25 us (1.05x faster)
mako 9.78 ms 8.19 ms (1.19x faster)
mdp 1.96 sec 1.93 sec (1.01x faster)
meteor_contest 83.7 ms 85.9 ms (1.03x slower)
nbody 80.5 ms 82.0 ms (not significant)
nqueens 75.9 ms 73.8 ms (1.03x faster)
pathlib 77.5 ms 73.4 ms (1.06x faster)
pickle 7.85 us 7.71 us (1.02x faster)
pickle_dict 20.9 us 22.0 us (1.05x slower)
pickle_list 3.11 us 3.23 us (1.04x slower)
pickle_pure_python 302 us 229 us (1.32x faster)
pidigits 167 ms 169 ms (1.01x slower)
pprint_pformat 1.39 sec 1.19 sec (1.17x faster)
pprint_safe_repr 676 ms 581 ms (1.16x faster)
pyflate 461 ms 359 ms (1.28x faster)
python_startup 25.0 ms 23.1 ms (1.08x faster)
python_startup_no_site 19.4 ms 19.8 ms (1.02x slower)
raytrace 320 ms 233 ms (1.38x faster)
regex_compile 118 ms 102 ms (1.16x faster)
regex_dna 148 ms 136 ms (1.09x faster)
regex_effbot 1.88 ms 1.72 ms (1.10x faster)
regex_v8 17.0 ms 15.5 ms (1.10x faster)
richards 46.6 ms 35.0 ms (1.33x faster)
richards_super 58.5 ms 43.1 ms (1.36x faster)
scimark_fft 214 ms 212 ms (1.01x faster)
scimark_lu 93.7 ms 71.5 ms (1.31x faster)
scimark_monte_carlo 64.1 ms 53.3 ms (1.20x faster)
scimark_sor 114 ms 87.5 ms (1.30x faster)
scimark_sparse_mat_mult 2.97 ms 2.97 ms (not significant)
spectral_norm 84.8 ms 77.2 ms (1.10x faster)
sqlglot_normalize 234 ms 219 ms (1.07x faster)
sqlglot_optimize 44.8 ms 40.6 ms (1.10x faster)
sqlglot_parse 1.40 ms 1.07 ms (1.30x faster)
sqlglot_transpile 1.67 ms 1.31 ms (1.28x faster)
sqlite_synth 2.16 us 1.97 us (1.10x faster)
sympy_expand 367 ms 350 ms (1.05x faster)
sympy_integrate 17.4 ms 15.9 ms (1.09x faster)
sympy_str 223 ms 215 ms (1.04x faster)
sympy_sum 124 ms 118 ms (1.05x faster)
telco 4.42 ms 4.60 ms (1.04x slower)
tomli_loads 1.89 sec 1.60 sec (1.18x faster)
tornado_http 140 ms 116 ms (1.20x faster)
typing_runtime_protocols 378 us 377 us (not significant)
unpack_sequence 44.9 ns 52.6 ns (1.17x slower)
unpickle 9.21 us 9.04 us (1.02x faster)
unpickle_list 3.16 us 2.99 us (1.06x faster)
unpickle_pure_python 209 us 173 us (1.21x faster)
xml_etree_generate 61.8 ms 62.2 ms (not significant)
xml_etree_iterparse 74.4 ms 75.5 ms (1.01x slower)
xml_etree_parse 114 ms 116 ms (1.02x slower)
xml_etree_process 49.5 ms 42.7 ms (1.16x faster)
Result (geometric mean) 1.09x faster

The result shows that Python 3.11 has the best performance results over Python 3.10 in the following tests: deltablue (1.56x faster), raytrace (1.38x faster), richards_super (1.36x faster). However, you may notice a drop in performance in some tests, especially in coverage (4.95x slower), asyncio_tcp_ssl (1.33x slower), unpack_sequence (1.17x slower).

Additionally, you can examine the performance differences between Python 3.11 and Python 3.10 based on benchmarks belonging to specific groups. The table below shows the geometric mean for benchmarks from separate groups for Python 3.11 compared to Python 3.10.

Group of benchmarks Python 3.11 to Python 3.10
apps 1.16x faster
asyncio 1.27x faster
math 1.03x faster
regex 1.11x faster
serialize 1.06x faster
startup 1.03x faster
template 1.14x faster
Polski
English
Русский