On 4/2/11 2:05 PM, John Nagle wrote:
There's no easy way to speed up Python; that's been tried. It needs either a very, very elaborate JIT system, more complex than the ones for Java or Self, or some language restrictions. The main restriction I would impose is to provide a call that says: "OK, we're done with loading, initialization, and configuration. Now freeze the code." At that moment, all the global analysis and compiling takes place. This allows getting rid of the GIL and getting real performance out of multithread CPUs.
That is not the reason the GIL exists, and being able to "freeze" the code will not let you get rid of the GIL alone. CPython's GIL exists to protect the data structures internal to its implementation and provide implicit protection to C extension modules (making them relatively easy to write threadsafe). Reference counts are the primary data structures being protected. IronPython and Jython allow just as much dynamism as CPython, and they have no mechanism for "freezing" the code, but they do not have a GIL. I believe this has been pointed out to you before, but I don't think I've seen you acknowledge it.
-- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco -- http://mail.python.org/mailman/listinfo/python-list