This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author besi7dollma
Recipients besi7dollma
Date 2021-09-28.13:32:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1632835923.15.0.15993520004.issue45311@roundup.psfhosted.org>
In-reply-to
Content
Hi, 
I was looking at the implementation of Semaphore and BoundedSemaphore in threading.py and I saw that `notify` is called on a loop n times while it supports an n parameter. 

https://github.com/python/cpython/blob/84975146a7ce64f1d50dcec8311b7f7188a5c962/Lib/threading.py#L479

Unless I am missing something, removing the loop and replacing it with self._cond.notify(n) will slightly improve performance by avoiding the function call overhead.

I can prepare a Pool Request if the change is acceptable.
Thanks,
History
Date User Action Args
2021-09-28 13:32:03besi7dollmasetrecipients: + besi7dollma
2021-09-28 13:32:03besi7dollmasetmessageid: <1632835923.15.0.15993520004.issue45311@roundup.psfhosted.org>
2021-09-28 13:32:03besi7dollmalinkissue45311 messages
2021-09-28 13:32:03besi7dollmacreate