
Nov. 24, 2009
6:39 p.m.
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. Regards Antoine. (*) using gcc's atomic primitives which, I have checked, are inlined as carefully optimized assembler: http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Atomic-Builtins.html#Atomic-Buil...