Python 3.12 vs Python 3.13 – performance testing

This article describes the performance testing results of Python 3.13 compared to Python 3.12. A total of 100 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.11.0 library in Python 3.12.7 and Python 3.13.0 (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 100 tests performed using Python 3.12 (as a reference) and Python 3.13 on this device.

Benchmark Python 3.12 Python 3.13
2to3 226 ms 217 ms (1.04x faster)
async_generators 262 ms 256 ms (1.02x faster)
async_tree_cpu_io_mixed 514 ms 411 ms (1.25x faster)
async_tree_cpu_io_mixed_tg 508 ms 393 ms (1.29x faster)
async_tree_eager 70.9 ms 73.4 ms (1.04x slower)
async_tree_eager_cpu_io_mixed 303 ms 312 ms (1.03x slower)
async_tree_eager_cpu_io_mixed_tg 278 ms 281 ms (not significant)
async_tree_eager_io 982 ms 636 ms (1.54x faster)
async_tree_eager_io_tg 969 ms 600 ms (1.61x faster)
async_tree_eager_memoization 170 ms 174 ms (1.03x slower)
async_tree_eager_memoization_tg 138 ms 140 ms (1.01x slower)
async_tree_eager_tg 49.0 ms 49.0 ms (not significant)
async_tree_io 852 ms 562 ms (1.52x faster)
async_tree_io_tg 865 ms 562 ms (1.54x faster)
async_tree_memoization 374 ms 290 ms (1.29x faster)
async_tree_memoization_tg 369 ms 307 ms (1.20x faster)
async_tree_none 310 ms 233 ms (1.33x faster)
async_tree_none_tg 284 ms 214 ms (1.32x faster)
asyncio_tcp 461 ms 451 ms (1.02x faster)
asyncio_tcp_ssl 1.88 sec 1.47 sec (1.28x faster)
bench_mp_pool 77.3 ms 77.7 ms (1.01x slower)
bench_thread_pool 692 us 667 us (1.04x faster)
chameleon 5.43 ms 4.90 ms (1.11x faster)
chaos 45.7 ms 39.4 ms (1.16x faster)
comprehensions 13.7 us 10.0 us (1.37x faster)
coroutines 15.7 ms 14.3 ms (1.10x faster)
coverage 35.4 ms 48.3 ms (1.36x slower)
create_gc_cycles 538 us 609 us (1.13x slower)
crypto_pyaes 51.6 ms 48.6 ms (1.06x faster)
dask 236 ms 248 ms (1.05x slower)
deepcopy 224 us 215 us (1.04x faster)
deepcopy_memo 25.8 us 23.6 us (1.09x faster)
deepcopy_reduce 2.08 us 2.00 us (1.04x faster)
deltablue 2.56 ms 2.15 ms (1.19x faster)
django_template 23.0 ms 22.6 ms (1.02x faster)
docutils 1.46 sec 1.40 sec (1.05x faster)
dulwich_log 49.6 ms 46.5 ms (1.07x faster)
fannkuch 258 ms 252 ms (not significant)
float 59.1 ms 54.2 ms (1.09x faster)
gc_traversal 1.23 ms 1.28 ms (1.03x slower)
generators 24.6 ms 19.9 ms (1.24x faster)
genshi_text 15.5 ms 15.6 ms (not significant)
genshi_xml 92.3 ms 89.3 ms (1.01x faster)
hexiom 4.56 ms 4.01 ms (1.14x faster)
html5lib 32.9 ms 32.0 ms (1.03x faster)
json_dumps 5.71 ms 5.79 ms (1.01x slower)
json_loads 13.6 us 14.1 us (1.04x slower)
logging_format 6.66 us 5.92 us (1.12x faster)
logging_silent 68.2 ns 63.3 ns (1.08x faster)
logging_simple 6.29 us 5.46 us (1.15x faster)
mako 7.56 ms 6.79 ms (1.11x faster)
mdp 1.61 sec 1.60 sec (not significant)
meteor_contest 67.3 ms 67.4 ms (not significant)
nbody 86.1 ms 78.3 ms (1.10x faster)
nqueens 65.3 ms 58.0 ms (1.13x faster)
pathlib 230 ms 226 ms (1.02x faster)
pickle 7.43 us 7.41 us (not significant)
pickle_dict 19.8 us 19.2 us (1.03x faster)
pickle_list 2.85 us 2.67 us (1.07x faster)
pickle_pure_python 199 us 178 us (1.12x faster)
pidigits 138 ms 135 ms (1.02x faster)
pprint_pformat 1.02 sec 998 ms (1.02x faster)
pprint_safe_repr 500 ms 488 ms (1.02x faster)
pyflate 322 ms 299 ms (1.08x faster)
python_startup 29.4 ms 30.7 ms (1.04x slower)
python_startup_no_site 31.8 ms 33.2 ms (1.05x slower)
raytrace 202 ms 171 ms (1.18x faster)
regex_compile 82.2 ms 71.1 ms (1.16x faster)
regex_dna 101 ms 103 ms (1.03x slower)
regex_effbot 1.79 ms 1.83 ms (1.02x slower)
regex_v8 14.3 ms 16.1 ms (1.13x slower)
richards 28.5 ms 28.7 ms (1.01x slower)
richards_super 32.0 ms 32.3 ms (1.01x slower)
scimark_fft 226 ms 209 ms (1.08x faster)
scimark_lu 76.9 ms 68.7 ms (1.12x faster)
scimark_monte_carlo 49.0 ms 44.7 ms (1.10x faster)
scimark_sor 92.5 ms 80.6 ms (1.15x faster)
scimark_sparse_mat_mult 3.55 ms 3.16 ms (1.13x faster)
spectral_norm 77.6 ms 70.4 ms (1.10x faster)
sqlglot_normalize 181 ms 170 ms (1.06x faster)
sqlglot_optimize 33.4 ms 32.2 ms (1.04x faster)
sqlglot_parse 866 us 781 us (1.11x faster)
sqlglot_transpile 1.05 ms 949 us (1.11x faster)
sqlite_synth 1.54 us 1.47 us (1.05x faster)
sympy_expand 249 ms 246 ms (1.01x faster)
sympy_integrate 11.6 ms 11.0 ms (1.06x faster)
sympy_str 155 ms 143 ms (1.08x faster)
sympy_sum 83.0 ms 75.1 ms (1.11x faster)
telco 4.40 ms 4.87 ms (1.11x slower)
tomli_loads 1.51 sec 1.40 sec (1.08x faster)
tornado_http 97.1 ms 91.7 ms (1.06x faster)
typing_runtime_protocols 105 us 97.6 us (1.08x faster)
unpack_sequence 53.5 ns 45.5 ns (1.17x faster)
unpickle 9.02 us 9.14 us (1.01x slower)
unpickle_list 3.19 us 2.75 us (1.16x faster)
unpickle_pure_python 153 us 134 us (1.14x faster)
xml_etree_generate 59.8 ms 57.0 ms (1.05x faster)
xml_etree_iterparse 58.7 ms 55.3 ms (1.06x faster)
xml_etree_parse 82.7 ms 76.6 ms (1.08x faster)
xml_etree_process 41.4 ms 39.6 ms (1.05x faster)
Result (geometric mean) 1.08x faster

The result shows that Python 3.13 has the best performance results over Python 3.12 in the following tests: async_tree_eager_io_tg (1.61x faster), async_tree_eager_io (1.54x faster), async_tree_io_tg (1.54x faster). However, you may notice a drop in performance in some tests, especially in coverage (1.36x slower), create_gc_cycles (1.13x slower), regex_v8 (1.13x slower).

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

Group of benchmarks Python 3.13 to Python 3.12
apps 1.06x faster
asyncio 1.22x faster
math 1.07x faster
regex not significant
serialize 1.05x faster
startup 1.04x slower
template 1.03x 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 98 tests performed using Python 3.12 (as a reference) and Python 3.13 on this device. The “dask” test was skipped because it failed to run on this configuration in Python 3.13.

Benchmark Python 3.12 Python 3.13
2to3 260 ms 256 ms (1.01x faster)
async_generators 253 ms 251 ms (1.01x faster)
async_tree_cpu_io_mixed 544 ms 428 ms (1.27x faster)
async_tree_cpu_io_mixed_tg 546 ms 412 ms (1.33x faster)
async_tree_eager 78.7 ms 83.9 ms (1.07x slower)
async_tree_eager_cpu_io_mixed 343 ms 336 ms (1.02x faster)
async_tree_eager_cpu_io_mixed_tg 307 ms 301 ms (1.02x faster)
async_tree_eager_io 818 ms 584 ms (1.40x faster)
async_tree_eager_io_tg 766 ms 556 ms (1.38x faster)
async_tree_eager_memoization 203 ms 203 ms (not significant)
async_tree_eager_memoization_tg 159 ms 161 ms (not significant)
async_tree_eager_tg 52.9 ms 54.1 ms (1.02x slower)
async_tree_io 776 ms 565 ms (1.37x faster)
async_tree_io_tg 798 ms 556 ms (1.43x faster)
async_tree_memoization 379 ms 308 ms (1.23x faster)
async_tree_memoization_tg 397 ms 322 ms (1.23x faster)
async_tree_none 330 ms 252 ms (1.31x faster)
async_tree_none_tg 310 ms 230 ms (1.35x faster)
asyncio_tcp 609 ms 585 ms (not significant)
asyncio_tcp_ssl 2.92 sec 1.93 sec (1.51x faster)
bench_mp_pool 93.2 ms 93.8 ms (not significant)
bench_thread_pool 1.02 ms 982 us (1.04x faster)
chameleon 5.53 ms 5.41 ms (1.02x faster)
chaos 49.3 ms 41.9 ms (1.18x faster)
comprehensions 15.6 us 11.4 us (1.37x faster)
coroutines 15.5 ms 14.1 ms (1.10x faster)
coverage 37.3 ms 144 ms (3.85x slower)
create_gc_cycles 783 us 883 us (1.13x slower)
crypto_pyaes 53.9 ms 50.0 ms (1.08x faster)
deepcopy 251 us 260 us (1.04x slower)
deepcopy_memo 27.2 us 25.4 us (1.07x faster)
deepcopy_reduce 2.24 us 2.30 us (1.03x slower)
deltablue 2.31 ms 2.11 ms (1.09x faster)
django_template 25.2 ms 24.9 ms (1.01x faster)
docutils 1.84 sec 1.93 sec (1.05x slower)
fannkuch 281 ms 278 ms (1.01x faster)
float 59.8 ms 54.6 ms (1.10x faster)
gc_traversal 1.78 ms 1.87 ms (1.05x slower)
generators 22.4 ms 22.4 ms (not significant)
genshi_text 16.3 ms 17.2 ms (1.06x slower)
genshi_xml 96.2 ms 96.8 ms (1.08x slower)
hexiom 4.48 ms 4.27 ms (1.05x faster)
html5lib 42.6 ms 44.2 ms (1.04x slower)
json_dumps 6.57 ms 6.64 ms (not significant)
json_loads 16.3 us 16.5 us (not significant)
logging_format 7.15 us 6.60 us (1.08x faster)
logging_silent 65.4 ns 59.6 ns (1.10x faster)
logging_simple 6.75 us 6.11 us (1.10x faster)
mako 7.30 ms 7.02 ms (1.04x faster)
mdp 1.65 sec 1.72 sec (1.04x slower)
meteor_contest 82.9 ms 81.2 ms (1.02x faster)
nbody 80.2 ms 75.7 ms (1.06x faster)
nqueens 66.3 ms 63.8 ms (1.04x faster)
pathlib 82.9 ms 81.1 ms (1.02x faster)
pickle 8.26 us 8.29 us (not significant)
pickle_dict 21.2 us 20.4 us (1.04x faster)
pickle_list 3.28 us 3.45 us (1.05x slower)
pickle_pure_python 218 us 209 us (1.04x faster)
pidigits 171 ms 168 ms (1.02x faster)
pprint_pformat 1.16 sec 1.13 sec (1.02x faster)
pprint_safe_repr 572 ms 560 ms (1.02x faster)
pyflate 341 ms 321 ms (1.06x faster)
python_startup 25.4 ms 26.1 ms (1.03x slower)
python_startup_no_site 21.9 ms 21.7 ms (not significant)
raytrace 218 ms 176 ms (1.24x faster)
regex_compile 97.5 ms 91.4 ms (1.07x faster)
regex_dna 131 ms 131 ms (not significant)
regex_effbot 1.79 ms 1.78 ms (not significant)
regex_v8 15.0 ms 18.9 ms (1.26x slower)
richards 29.8 ms 29.2 ms (1.02x faster)
richards_super 33.8 ms 33.3 ms (1.02x faster)
scimark_fft 220 ms 193 ms (1.14x faster)
scimark_lu 70.5 ms 60.1 ms (1.17x faster)
scimark_monte_carlo 49.7 ms 45.7 ms (1.09x faster)
scimark_sor 92.4 ms 81.5 ms (1.13x faster)
scimark_sparse_mat_mult 3.14 ms 2.64 ms (1.19x faster)
spectral_norm 77.4 ms 66.6 ms (1.16x faster)
sqlglot_normalize 203 ms 202 ms (1.01x faster)
sqlglot_optimize 37.8 ms 38.4 ms (1.01x slower)
sqlglot_parse 922 us 860 us (1.07x faster)
sqlglot_transpile 1.16 ms 1.10 ms (1.06x faster)
sqlite_synth 1.96 us 1.83 us (1.07x faster)
sympy_expand 307 ms 331 ms (1.08x slower)
sympy_integrate 14.3 ms 14.0 ms (1.02x faster)
sympy_str 189 ms 191 ms (1.01x slower)
sympy_sum 100 ms 99.3 ms (1.01x faster)
telco 4.70 ms 5.62 ms (1.19x slower)
tomli_loads 1.56 sec 1.58 sec (1.01x slower)
tornado_http 103 ms 97.7 ms (1.05x faster)
typing_runtime_protocols 121 us 116 us (1.05x faster)
unpack_sequence 57.4 ns 44.4 ns (1.29x faster)
unpickle 9.62 us 9.89 us (1.03x slower)
unpickle_list 3.28 us 3.05 us (1.07x faster)
unpickle_pure_python 151 us 144 us (1.05x faster)
xml_etree_generate 63.7 ms 60.2 ms (1.06x faster)
xml_etree_iterparse 71.7 ms 67.4 ms (1.06x faster)
xml_etree_parse 106 ms 104 ms (1.02x faster)
xml_etree_process 42.9 ms 41.9 ms (1.02x faster)
Result (geometric mean) 1.05x faster

The result shows that Python 3.13 has the best performance results over Python 3.12 in the following tests: asyncio_tcp_ssl (1.51x faster), async_tree_io_tg (1.43x faster), async_tree_eager_io (1.40x faster). However, you may notice a drop in performance in some tests, especially in coverage (3.85x slower), regex_v8 (1.26x slower), telco (1.19x slower).

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

Group of benchmarks Python 3.13 to Python 3.12
apps not significant
asyncio 1.19x faster
math 1.06x faster
regex 1.04x slower
serialize 1.02x faster
startup 1.01x slower
template 1.02x slower
Polski
English
Русский