[pypy-dev] Twisted's deferToThread is much more slower with pypy than on cpython
Armin Rigo
arigo at tunes.org
Sun Jul 17 03:48:53 EDT 2016
Hi Nagy,
On 3 June 2016 at 09:45, Nagy, Attila <bra at fsn.hu> wrote:
> Consider this example program:
> https://gist.github.com/bra-fsn/1fd481b44590a939e849cb9073ba1a41
I think I fixed this problem in 919e00b3e558 two days ago. Now it
seems to always use about 100% CPU and gets performance that is a bit
better than CPython, instead of spending all its time sleeping. Yay
:-)
I did some tests to measure how well PyPy and CPython perform when
running 2 or 3 threads in various microbenchmark-like situations
(running pure Python code; acquiring and releasing the same lock;
ping-pong between two threads; calling a fast or slow C function).
Now in all measured cases PyPy should perform not too badly. Actually
in most cases it was already better than CPython for fairness: for
example, when one thread runs pure Python code and the other thread
does many calls to a very fast C function, then CPython gives about
0.002% of the time(!) to the second thread and the rest to the first
one.
These tests can be found in
https://bitbucket.org/arigo/arigo/src/default/hack/pypy-hack/gil-benchmark/
.
A bientôt,
Armin.
More information about the pypy-dev
mailing list