From a0a3a3a60559798189586f123a4fa80d164b1ede Mon Sep 17 00:00:00 2001 From: Kien Nguyen Tuan Date: Fri, 8 Nov 2024 13:55:09 +0700 Subject: [PATCH] cpython 3.13 --- python/python3.13_performance.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 python/python3.13_performance.md diff --git a/python/python3.13_performance.md b/python/python3.13_performance.md new file mode 100644 index 0000000..a004e37 --- /dev/null +++ b/python/python3.13_performance.md @@ -0,0 +1,14 @@ +# Python 3.13 Performance: Free-Threading + +Source: + +CPython 3.13: + +- CPython can now run in **free-threaded mode**, with the global interpreter lock (GIL) disabled + - An experimental feature in Python 3.13 that allows CPython to run without the Global interpreter lock (GIL). The GIL is a mutex preventing multiple threads from executing Python bytecode simultaneously. This design choice has simplified CPython's memory management and made the C API easier to work with. However, it has also been one of the most significant barriers to utilizing modern multi-core processors effectively. + - The traditional solution has been to use the `multiprocessing` module, which spawns separate Python processes instead of threads and while this approach works, it comes with significant limitations: + - Memory overhead. + - Communication cost. + - Startup time. +- a brand new **just-in-time (JIT)** compiler has been added +- CPython now bundles the `mimalloc` allocator out of the box