[issue36051] Drop the GIL during large bytes.join operations?

Inada Naoki report at bugs.python.org
Thu Jan 2 00:35:13 EST 2020


Inada Naoki <songofacandy at gmail.com> added the comment:

> In the single-threaded case, the benchmark seems to show that for 64K+, performance is improved by dropping the GIL (which I'm guessing must be statistical noise, since there shouldn't be anything contending for it), which is my reasoning behind the 65536 threshold.

Yes, single-threaded case shouldn't affected by this change.  Dropping GIL is just a very little overhead.

So you need to focus on multi-threaded case when considering threshold.
As far as seeing your result, 65536 threshold seems too small.
See 512*8192 case.  It shows 1479->980 regression.
But I don't think your script shows real performance.

I updated your patch, and I saw small improvement on 512K and significant improvement on 1M.

----------
Added file: https://bugs.python.org/file48816/benchjoin2.py

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36051>
_______________________________________


More information about the Python-bugs-list mailing list