Fundamentals 10 min read

How Python’s New No‑GIL Build Unlocks True Multicore Performance

This article explains the history and drawbacks of Python’s Global Interpreter Lock, introduces PEP 703’s optional no‑GIL build, provides step‑by‑step installation instructions, showcases performance benchmarks, and discusses the impact on developers and the Python community.

Python Programming Learning Circle
Python Programming Learning Circle
Python Programming Learning Circle
How Python’s New No‑GIL Build Unlocks True Multicore Performance

Quick Overview: What is GIL?

In simple terms, the Global Interpreter Lock (GIL) is a mutex that ensures only one thread executes Python bytecode at a time.

Introduced in the early 1990s, the GIL provided thread safety and simplicity when single‑core CPUs were the norm, and it eased integration with C extensions, boosting Python’s adoption.

Today, with multi‑core CPUs ubiquitous, the GIL is a major bottleneck for CPU‑bound multithreaded programs, which is why many developers claim “Python is slow.”

CPU illustration
CPU illustration

Why the GIL Is a Problem

Because of the GIL’s design, Python threads cannot run truly in parallel, making CPU‑intensive multithreaded programs unsuitable for Python.

Developers have resorted to workarounds such as multiprocessing (spawning separate processes) or using external libraries like NumPy and Cython that offload heavy computation to compiled C extensions. These solutions add complexity, overhead, and resource consumption.

The Python community has long called for the GIL’s removal, but Guido van Rossum noted that eliminating the GIL without harming single‑thread performance or breaking backward compatibility is extremely difficult.

PEP 703: A New Era (No‑GIL)

PEP 703 proposes making the GIL optional via a new build‑time flag

--disable-gil

. The proposal outlines a phased rollout:

Python 3.13 (2024): optional no‑GIL build for testing and community feedback.

Transition period (~2026‑2027): unified build with runtime GIL toggling.

Future goal (~2028+): no‑GIL Python becomes the default, fully unlocking multicore parallelism.

How to Set Up a No‑GIL Python

Below are the steps to install the experimental no‑GIL Python on macOS (the process is similar on other OSes).

Python 3.13 installer
Python 3.13 installer

Download the latest Python 3.13 installer from the official website, run it, and select the “Free‑Threaded Python [experimental]” option during the installation type step.

Installation type selection
Installation type selection

After installation, run the

/Applications/Python 3.13/Install Certificates.command

script to install SSL root certificates.

Install SSL certificates
Install SSL certificates

Two applications are now installed:

Python 3.13

(standard) and

Python 3.13t

(experimental no‑GIL).

Run the no‑GIL interpreter simply with

python3.13t

.

Benchmark: Standard vs. No‑GIL Python

The following script creates four threads, each performing a CPU‑intensive task.

<code>import threading, time

def cpu_bound_task(n, thread_id):
    count = 0
    for i in range(n):
        count += i*i

N = 100000000

def run_with_threads():
    threads = []
    start = time.time()
    # create and start 4 threads
    for i in range(4):
        t = threading.Thread(target=cpu_bound_task, args=(N, i))
        threads.append(t)
        t.start()
    # wait for all threads
    for t in threads:
        t.join()
    end = time.time()
    print(f'Total time taken: {end - start:.2f} seconds')

if __name__ == '__main__':
    run_with_threads()
</code>

Running it with standard Python 3.13 yields about 13.51 seconds:

Standard Python benchmark result
Standard Python benchmark result

Running the same script with the experimental no‑GIL Python 3.13t drops the time to roughly 3.74 seconds:

No‑GIL Python benchmark result
No‑GIL Python benchmark result

The numbers demonstrate that removing the GIL enables true multithreading speed‑ups.

Community Reaction

The Python community, especially data‑science and AI engineers, is excited about the performance gains. Major tech companies like Meta are already investing resources to support the transition.

What This Means for Python Developers

In the near term, the no‑GIL build is experimental and not recommended for production due to potential compatibility and stability issues. However, developers should monitor its progress, as it is slated to become the default around 2028.

In summary, the gradual removal of the GIL marks a significant milestone for Python’s evolution, promising true multicore performance for future applications.

Original English article: https://medium.com/techtofreedom/python-is-removing-gil-gradually-b41274fa62a4

PerformancepythonmultithreadingGILPEP703No-GIL
Python Programming Learning Circle
Written by

Python Programming Learning Circle

A global community of Chinese Python developers offering technical articles, columns, original video tutorials, and problem sets. Topics include web full‑stack development, web scraping, data analysis, natural language processing, image processing, machine learning, automated testing, DevOps automation, and big data.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.