I am excited to experiment with python3.13 with new GIL optional feature. I want to explore the impact of disabling GIL to achieve real multi-threading in python. I want a real world example to compare the python3.13 performance for multi-threading with GIL enabled and disabled.
In the same environment, can i run two python one with GIL and other without GIL?
REF: PEP703
According to the What's new in Python 3.13, you need a new Python binary to test it.
The free-threaded mode requires a different executable, usually called python3.13t or python3.13t.exe.
Using pyenv latest version to install Python, this should give you a virtual environment to test it (in most unix systems):
pyenv install 3.13t-dev
$HOME/.pyenv/versions/3.13t-dev/bin/python3.13t -m venv .venv
source .venv/bin/activate
You can check it with sys._is_gil_enabled()
python -c 'import sys; print(sys._is_gil_enabled())'
# you should get 'False'
Ubunt users can use:
sudo add-apt-repository ppa:deadsnakes
sudo apt-get update
sudo apt-get install python3.13-nogil
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With