News for hackers. Stuff that matters.
Re:Presentation on the new Python GIL by st3fan on Sunday January 17, 2010 @04:21PM (#1058948)
"""Does it work? Yes it's better: Sequential 23.5 seconds. Threaded 24.0 seconds."""

How is that better? It is an improvement over earlier versions of Python. Better would be if the threaded version would actually be twice as fast.

Re:Presentation on the new Python GIL by mitchellh on Sunday January 17, 2010 @05:29PM (#1059045)
If you look at the code he used to test this, its completely CPU-bound, meaning that it requires the GIL to run. And since the GIL is, well, a "GIL," that means that only one can run at any single time.

Therefore, the expected behavior of running these two threads would be to have identical runtimes. That would be the "perfect" case with a GIL. So with this "better" GIL its actually near-perfect in this _simple_ case. (Like the presenter said, there needs to be more tests to study the behavior under heavier tasks)

What you're describing, with the threaded being "twice as fast" assumes that the threads will allow two python-instruction-bound tasks to run concurrently, which would require having no GIL.

Re:Presentation on the new Python GIL by jnoller on Sunday January 17, 2010 @04:37PM (#1058974)
An improvement over the old implementation is better. "Fixed and Perfect" would be free-threading, where it would be twice as fast with threads.

I'll take incremental, concrete improvements anytime.

Re:Presentation on the new Python GIL by Luyt on Sunday January 17, 2010 @05:00PM (#1059014)
If you really want to speed up your program, you have to parallelize and distribute the workload over multiple cores. Python has a module in the standard library for this, it's called 'multiprocessing'. See http://docs.python.org/library/multiprocessing.html
Re:Presentation on the new Python GIL by rbanffy on Sunday January 17, 2010 @05:55PM (#1059081)
It won't help if you have to do stuff over a single shared data structure.
Re:Presentation on the new Python GIL by st3fan on Sunday January 17, 2010 @07:52PM (#1059201)
Well you can of course. It is just a pain to do it.
Re:Presentation on the new Python GIL by rbanffy on Monday January 18, 2010 @05:19AM (#1059679)
That's a good point. I rarely had to do it and, when I could, I opted to distribute the data.

Still, Python needs better threading.

Re:Presentation on the new Python GIL by whatusername on Sunday January 17, 2010 @10:58PM (#1059413)
From Slide 7: Sequential (Single Core) : 24.6s

Threaded (Dual Core) : 45.5s

Threaded (With a CPU core diabled) : 38.0s

23.5 / 24.0 is an improvement to both tests - and a significant improvement to the Threaded one.