diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-02-02 18:37:49 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-02-02 19:32:13 +0100 |
commit | 48460703229d73fbacdd0d6b0d0f01a54f7ce751 (patch) | |
tree | 991cf63384f64b206b3c82dbbb15532c6f011d4a /device/device.go | |
parent | a9f80d8c587df99c6e8f57704aef3fe1ac62d0db (diff) | |
download | wireguard-go-48460703229d73fbacdd0d6b0d0f01a54f7ce751.tar.gz wireguard-go-48460703229d73fbacdd0d6b0d0f01a54f7ce751.zip |
device: use a waiting sync.Pool instead of a channel
Channels are FIFO which means we have guaranteed cache misses.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'device/device.go')
-rw-r--r-- | device/device.go | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/device/device.go b/device/device.go index bac361e..5f36036 100644 --- a/device/device.go +++ b/device/device.go @@ -67,12 +67,9 @@ type Device struct { } pool struct { - messageBufferPool *sync.Pool - messageBufferReuseChan chan *[MaxMessageSize]byte - inboundElementPool *sync.Pool - inboundElementReuseChan chan *QueueInboundElement - outboundElementPool *sync.Pool - outboundElementReuseChan chan *QueueOutboundElement + messageBuffers *WaitPool + inboundElements *WaitPool + outboundElements *WaitPool } queue struct { |