From 1ec454f253c068f74ba7a7aea34546c9819493c0 Mon Sep 17 00:00:00 2001 From: Jordan Whited Date: Mon, 2 Oct 2023 14:48:28 -0700 Subject: device: move Queue{In,Out}boundElement Mutex to container type Queue{In,Out}boundElement locking can contribute to significant overhead via sync.Mutex.lockSlow() in some environments. These types are passed throughout the device package as elements in a slice, so move the per-element Mutex to a container around the slice. Reviewed-by: Maisem Ali Signed-off-by: Jordan Whited Signed-off-by: Jason A. Donenfeld --- device/device.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'device/device.go') diff --git a/device/device.go b/device/device.go index 1af9fe0..f9557a0 100644 --- a/device/device.go +++ b/device/device.go @@ -68,11 +68,11 @@ type Device struct { cookieChecker CookieChecker pool struct { - outboundElementsSlice *WaitPool - inboundElementsSlice *WaitPool - messageBuffers *WaitPool - inboundElements *WaitPool - outboundElements *WaitPool + inboundElementsContainer *WaitPool + outboundElementsContainer *WaitPool + messageBuffers *WaitPool + inboundElements *WaitPool + outboundElements *WaitPool } queue struct { -- cgit v1.2.3