[Python-Dev] GIL behaviour under Windows (original) (raw)

John Arbash Meinel john at arbash-meinel.com
Wed Oct 21 17:15:56 CEST 2009


-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1

Antoine Pitrou wrote:

I don't really know how this test works, so I won't claim to understand the results either. However, here you go: Thanks. Interesting results. I wonder what they would be like on a multi-core machine. The GIL seems to behave perfectly on your setup (no performance degradation due to concurrency, and zero latencies).

C:\downloads>C:\Python26\python.exe ccbench.py

Pi calculation (Python)

threads=1: 691 iterations/s. threads=2: 400 ( 57 %) threads=3: 453 ( 65 %) threads=4: 467 ( 67 %)

^- seems to have some contention

regular expression (C)

threads=1: 592 iterations/s. threads=2: 598 ( 101 %) threads=3: 587 ( 99 %) threads=4: 586 ( 99 %)

bz2 compression (C)

threads=1: 536 iterations/s. threads=2: 1056 ( 196 %) threads=3: 1040 ( 193 %) threads=4: 1060 ( 197 %)

^- seems to properly show that I have 2 cores here.

Background CPU task: Pi calculation (Python)

CPU threads=0: 0 ms. (std dev: 0 ms.) CPU threads=1: 0 ms. (std dev: 0 ms.) CPU threads=2: 0 ms. (std dev: 0 ms.) CPU threads=3: 0 ms. (std dev: 0 ms.) CPU threads=4: 0 ms. (std dev: 0 ms.)

Background CPU task: regular expression (C)

CPU threads=0: 0 ms. (std dev: 0 ms.) CPU threads=1: 38 ms. (std dev: 18 ms.) CPU threads=2: 173 ms. (std dev: 77 ms.) CPU threads=3: 518 ms. (std dev: 264 ms.) CPU threads=4: 661 ms. (std dev: 343 ms.)

Background CPU task: bz2 compression (C)

CPU threads=0: 0 ms. (std dev: 0 ms.) CPU threads=1: 0 ms. (std dev: 0 ms.) CPU threads=2: 0 ms. (std dev: 0 ms.) CPU threads=3: 0 ms. (std dev: 0 ms.) CPU threads=4: 0 ms. (std dev: 0 ms.)

John =;-> -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Cygwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkrfJawACgkQJdeBCYSNAANQlgCgwx0TCLh7YhLSJxkfOuMi1/YF XhkAoIONtdP0rR1YW0nDza+wpKpAlInd =L4WZ -----END PGP SIGNATURE-----



More information about the Python-Dev mailing list