Commit 079c217
committed
perf(pool): eliminate mutex overhead in state machine hot path
The state machine was calling notifyWaiters() on EVERY Get/Put operation,
which acquired a mutex even when no waiters were present (the common case).
Fix: Check waiters.Len() BEFORE acquiring mutex in notifyWaiters().
This eliminates mutex contention in the hot path (Get/Put operations).
Performance impact:
- Before: mutex lock/unlock on every Get/Put (even with no waiters)
- After: lock-free check, only acquire mutex if waiters exist
- Expected improvement: ~30-50% for Get/Put operations1 parent 1b0168d commit 079c217
1 file changed
+10
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
238 | 238 | | |
239 | 239 | | |
240 | 240 | | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
241 | 250 | | |
242 | 251 | | |
243 | 252 | | |
| 253 | + | |
244 | 254 | | |
245 | 255 | | |
246 | 256 | | |
| |||
0 commit comments