From 6acd82667aa41d5334c4f2e313cde7db66d5a2d0 Mon Sep 17 00:00:00 2001 From: Shulhan Date: Thu, 9 Jun 2022 00:08:36 +0700 Subject: lib/websocket: realign struct Handshake This realign save 40 bytes allocation, from 160 to 120 bytes. --- lib/websocket/handshake.go | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/websocket/handshake.go b/lib/websocket/handshake.go index c26b8226..434c4cab 100644 --- a/lib/websocket/handshake.go +++ b/lib/websocket/handshake.go @@ -70,17 +70,16 @@ var ( // Handshake contains the websocket HTTP handshake request. type Handshake struct { + URL *url.URL + Header http.Header + Host []byte + Key []byte + Extensions []byte + Protocol []byte + raw []byte start int end int headerFlags int - raw []byte - - URL *url.URL - Host []byte - Key []byte - Extensions []byte - Protocol []byte - Header http.Header } func newHandshake(req []byte) (h *Handshake, err error) { -- cgit v1.3