aboutsummaryrefslogtreecommitdiff
path: root/fasthttputil
diff options
context:
space:
mode:
authorGravatar Aliaksandr Valialkin <valyala@gmail.com> 2016-02-04 19:48:52 +0200
committerGravatar Aliaksandr Valialkin <valyala@gmail.com> 2016-02-04 19:48:52 +0200
commit08aecdd0f4248370b14d898034dc1925bdcebf97 (patch)
treee4467481a33c3ce668b130c7b9a8b188734b5601 /fasthttputil
parentfasthttputil: pipe errors cleanup (diff)
downloadfasthttp-08aecdd0f4248370b14d898034dc1925bdcebf97.tar.gz
fasthttp-08aecdd0f4248370b14d898034dc1925bdcebf97.tar.bz2
fasthttp-08aecdd0f4248370b14d898034dc1925bdcebf97.zip
fasthttputil: pre-allocate memory in newly created byteBuffer
Diffstat (limited to 'fasthttputil')
-rw-r--r--fasthttputil/pipe.go4
1 files changed, 3 insertions, 1 deletions
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),
+ }
},
}