From 08aecdd0f4248370b14d898034dc1925bdcebf97 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Thu, 4 Feb 2016 19:48:52 +0200 Subject: [PATCH] fasthttputil: pre-allocate memory in newly created byteBuffer --- fasthttputil/pipe.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fasthttputil/pipe.go b/fasthttputil/pipe.go index acf8d27..0006e5d 100644 --- a/fasthttputil/pipe.go +++ b/fasthttputil/pipe.go @@ -246,7 +246,9 @@ func releaseByteBuffer(b *byteBuffer) { var byteBufferPool = &sync.Pool{ New: func() interface{} { - return &byteBuffer{} + return &byteBuffer{ + b: make([]byte, 1024), + } }, }