[Python-ideas] Remove GIL with CAS instructions?
solipsis at pitrou.net
Tue Nov 24 19:39:03 CET 2009
Ok, out of curiousity I gave it a try: replacing INCREF/DECREF with atomic
instructions (*) slows down the interpreter by 20 to 40% depending on the
workload. And keep in mind this is the tip of the iceberg: to remove the GIL
you'd also have to add fine-grained locking in other places (dicts etc.).
Which makes me agree with the commonly expressed opinion that CPython would
probably need to ditch refcounting (at least in the critical paths) if we want
to remove the GIL.
(*) using gcc's atomic primitives which, I have checked, are inlined as
carefully optimized assembler:
More information about the Python-ideas