Will Python 3.0 remove the global interpreter lock (GIL)

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Wed Sep 19 21:46:15 EDT 2007


On Wed, 19 Sep 2007 15:59:59 -0700, TheFlyingDutchman wrote:

> Paul it's a pleasure to see that you are not entirely against
> complaints.

I'm not against complaints either, so long as they are well-thought out. 
I've made a few of my own over the years, some of which may have been 
less well-thought out than others.


> The very fastest Intel processor of the last 1990's that I found came
> out in October 1999 and had a speed around 783Mhz. Current fastest
> processors are something like 3.74 Ghz, with larger caches. Memory is
> also faster and larger. It appears that someone running a non-GIL
> implementation of CPython today would have significantly faster
> performance than a GIL CPython implementation of the late 1990's.

That's an irrelevant comparison. It's a STUPID comparison. The two 
alternatives aren't "non-GIL CPython on 2007 hardware" versus "GIL 
CPython on 1999 hardware" because we aren't using GIL CPython on 1999 
hardware, we're using it on 2007 hardware. *That's* the alternative to 
the non-GIL CPython that you need to compare against.

Why turn your back on eight years of faster hardware? What's the point of 
getting rid of the GIL unless it leads to faster code? "Get the speed and 
performance of 1999 today!" doesn't seem much of a selling point in 2007.


> Correct me if I am wrong, but it seems that saying non-GIL CPython is
> too slow, while once valid, has become invalid due to the increase in
> computing power that has taken place.

You're wrong, because the finishing line has shifted -- performance we 
were satisfied with in 1998 would be considered unbearable to work with 
in 2007.

I remember in 1996 (give or take a year) being pleased that my new 
computer allowed my Pascal compiler to compile a basic, bare-bones GUI 
text editor in a mere two or four hours, because it used to take up to 
half a day on my older computer. Now, I expect to compile a basic text 
editor in minutes, not hours.

According to http://linuxreviews.org/gentoo/compiletimes/

the whole of Openoffice-ximian takes around six hours to compile. Given 
the speed of my 1996 computer, it would probably take six YEARS to 
compile something of Openoffice's complexity.


As a purely academic exercise, we might concede that the non-GIL version 
of CPython 1.5 running on a modern, dual-core CPU with lots of RAM will 
be faster than CPython 2.5 running on an eight-year old CPU with minimal 
RAM. But so what? That's of zero practical interest for anyone running 
CPython 2.5 on a modern PC.

If you are running a 1999 PC, your best bet is to stick with the standard 
CPython 1.5 including the GIL, because it is faster than the non-GIL 
version.

If you are running a 2007 PC, your best bet is *still* to stick with the 
standard CPython (version 2.5 now, not 1.5), because it will still be 
faster than the non-GIL version (unless you have four or more processors, 
and maybe not even then).

Otherwise, there's always Jython or IronPython.



-- 
Steven.



More information about the Python-list mailing list