From a7f65b40c57c5b0c55762d9caff6227a5985549e Mon Sep 17 00:00:00 2001 From: James Tucker Date: Fri, 12 Jan 2024 12:25:12 -0800 Subject: [PATCH] derp: optimize field order to reduce GC cost See the field alignment lints for more information. Reductions are 64->24 and 64->32 respectively. Updates #self Signed-off-by: James Tucker --- derp/derp_server.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/derp/derp_server.go b/derp/derp_server.go index f9c8ab40f..5b9e7e7dc 100644 --- a/derp/derp_server.go +++ b/derp/derp_server.go @@ -1354,16 +1354,13 @@ type sclient struct { // peerConnState represents whether a peer is connected to the server // or not. type peerConnState struct { + ipPort netip.AddrPort // if present, the peer's IP:port peer key.NodePublic present bool - ipPort netip.AddrPort // if present, the peer's IP:port } // pkt is a request to write a data frame to an sclient. type pkt struct { - // src is the who's the sender of the packet. - src key.NodePublic - // enqueuedAt is when a packet was put onto a queue before it was sent, // and is used for reporting metrics on the duration of packets in the queue. enqueuedAt time.Time @@ -1371,6 +1368,9 @@ type pkt struct { // bs is the data packet bytes. // The memory is owned by pkt. bs []byte + + // src is the who's the sender of the packet. + src key.NodePublic } // peerGoneMsg is a request to write a peerGone frame to an sclient