From e58179edcd23114aaaa23bc2e0d2a7d8fee0c6e1 Mon Sep 17 00:00:00 2001 From: Juan Calderon-Perez Date: Sat, 20 Jul 2024 16:13:27 -0400 Subject: [PATCH] Optimize struct field order to reduce memory usage by 184 bytes --- bytebuffer.go | 1 - pool.go | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/bytebuffer.go b/bytebuffer.go index 07a055a..f40de39 100644 --- a/bytebuffer.go +++ b/bytebuffer.go @@ -10,7 +10,6 @@ import "io" // // Use Get for obtaining an empty byte buffer. type ByteBuffer struct { - // B is a byte buffer to use in append-like workloads. // See example code for details. B []byte diff --git a/pool.go b/pool.go index 8bb4134..6cccfa0 100644 --- a/pool.go +++ b/pool.go @@ -23,13 +23,12 @@ const ( // Properly determined byte buffer types with their own pools may help reducing // memory waste. type Pool struct { + pool sync.Pool calls [steps]uint64 calibrating uint64 defaultSize uint64 maxSize uint64 - - pool sync.Pool } var defaultPool Pool