See this line in _drainUnlockWaiters:
for (let weight = this._value; weight > 0; weight--) {
and a second one below.
This impacts performance when using Semaphores with very large values, such as 2147483628.
Performing this operation efficiently may not be trivial as the best data structure is highly situation-dependent.
See this line in
_drainUnlockWaiters:and a second one below.
This impacts performance when using Semaphores with very large values, such as
2147483628.Performing this operation efficiently may not be trivial as the best data structure is highly situation-dependent.