Hacker News new | past | comments | ask | show | jobs | submit login

Not in single threaded code.



Umm, yes it does? For the longest time, Guido’s defense for the GIL was that all previous efforts resulted in an unacceptable hit to single threaded performance.

Read PEP-703 (https://peps.python.org/pep-0703/#performance) where the performance hit is currently 5-8%


That's to make it thread safe without the GIL.

If you only care about single thread there's all kinds of stuff you can do.


How to ensure there are no other threads, confidently enough that one can turn thread safety off?


From when I was reading the proposal, the idea is that until a C extension is loaded, you can assume that there are no other threads. Then when a module is loaded, by default you assume that it uses threads but modules that are thread free can indicate that using a flag, so if a module indicates it's thread free then you continue running without the thread safety features.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: