Our Plan for Python 3.13
Every single HN thread on python performance, ever:<p>Person with limited to zero experience with CPython internals&gt; I hate the GIL, why don&#x27;t they <i>just remove it</i>?<p>That <i>just</i> is doing an incredible amount of heavy lifting. It&#x27;d be like saying, &quot;Why doesn&#x27;t the USA <i>just</i> switch entirely to the metric system?&quot; It&#x27;s a huge ask, and after being burned by the 2&#x2F;3 transition, the python team is loathe to rock to boat too much again.<p>The GIL is deep, arguably one of the deepest abstractions in the codebase, up there with PyObject itself. Think about having to redefine the String implementation of a codebase in your language of choice.<p>Whatever your monday-morning quarterback idea on how to pull out the GIL is, I can almost guarantee, someone has thought about it, probably implemented it, and determined it will have one or more side effects:<p>- Reduced single-thread performance<p>- Breaking ABI&#x2F;FFI compatibility<p>- Not breaking ABI immediately, but massively introducing the risk of hard to track concurrency bugs that didn&#x27;t exist before, because GIL<p>- Creating a maintenance nightmare by adding tons of complexity, switches, conditionals, etc to the codebase<p>The team has already decided those tradeoffs are not really justifiable.<p>The GILectomy project has probably come the closest, but it impacts single-thread performance by introducing a mutex (there are some reference type tricks [1] to mitigate the hit, but it still hurts run time 10-50%), and necessitates any extension libraries update their code in a strongly API-breaking way.<p>It&#x27;s possible that over time, there are improvements which simultaneously improve performance or maintainability, while also lessening the pain of a future GILectomy, e.g. anything which reduces the reliance on checking reference counts.<p>[1] PEP 683 is probably a prerequisite for any future GILectomy attempts, which looks like it has been accepted, which is great <a href="https:&#x2F;&#x2F;peps.python.org&#x2F;pep-0683&#x2F;" rel="nofollow noreferrer">https:&#x2F;&#x2F;peps.python.org&#x2F;pep-0683&#x2F;</a>