Skip to content

Instantly share code, notes, and snippets.

@colesbury
Last active November 1, 2021 12:00
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save colesbury/8479ee0246558fa1ab0f49e4c01caeed to your computer and use it in GitHub Desktop.
Save colesbury/8479ee0246558fa1ab0f49e4c01caeed to your computer and use it in GitHub Desktop.
== CPython 3.9.0a4+ (heads/nogil:fb6aabede5) ==
== x86_64 Linux on 'x86_64' ==
--- Throughput ---
Pi calculation (Python)
threads=1: 1546 iterations/s.
threads=2: 3011 ( 194 %)
threads=3: 4523 ( 292 %)
threads=4: 6029 ( 389 %)
regular expression (C)
threads=1: 531 iterations/s.
threads=2: 1051 ( 197 %)
threads=3: 1571 ( 295 %)
threads=4: 2091 ( 393 %)
bz2 compression (C)
threads=1: 562 iterations/s.
threads=2: 1112 ( 197 %)
threads=3: 1676 ( 298 %)
threads=4: 2231 ( 396 %)
--- Latency ---
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: 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: 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.)
--- I/O bandwidth ---
Background CPU task: Pi calculation (Python)
CPU threads=0: 32886.3 packets/s.
CPU threads=1: 33697.6 ( 102 %)
CPU threads=2: 32736.7 ( 99 %)
CPU threads=3: 33038.0 ( 100 %)
CPU threads=4: 33478.9 ( 101 %)
@h-vetinari
Copy link

Thanks for the benchmarks!

In your mail to python-dev, this link appears twice though - probably a copy & paste error?

Here are the full results for 20 threads without the GIL:
https://gist.github.com/colesbury/8479ee0246558fa1ab0f49e4c01caeed (nogil,
20 threads)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment