Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-36051: drop GIL during large b''.join operations #17757

Open
wants to merge 1 commit into
base: master
from

Conversation

@bmerry
Copy link

bmerry commented Dec 30, 2019

Improve multi-threaded performance by dropping the GIL in the fast path
of bytes.join. To avoid increasing overhead for small joins, it is only
done if the output size exceeds a threshold.

https://bugs.python.org/issue36051

Improve multi-threaded performance by dropping the GIL in the fast path
of bytes.join. To avoid increasing overhead for small joins, it is only
done if the output size exceeds a threshold.
@bmerry

This comment has been minimized.

Copy link
Author

bmerry commented Dec 30, 2019

For now I've only made the change for the b''.join fast-path, but if there is agreement I could also add it to the general case (non-empty separator).

I think the code is safe against another thread mutating the sequence while the GIL is dropped (because the setup code takes it own refs to all the items), but it would be good if someone could double-check it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.