New submission from Besart Dollma <besi7dol...@gmail.com>:
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, ---------- components: Library (Lib) messages: 402779 nosy: besi7dollma priority: normal severity: normal status: open title: Threading Semaphore and BoundedSemaphore release method implementation improvement type: enhancement versions: Python 3.9 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue45311> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com