User buffer pool where appropriate

This commit is contained in:
Ingo Oppermann
2024-10-10 15:09:50 +02:00
parent 91874e6caf
commit a581f1dbc2
13 changed files with 207 additions and 67 deletions

View File

@@ -31,3 +31,17 @@ func (p *BufferPool) Get() *bytes.Buffer {
func (p *BufferPool) Put(buf *bytes.Buffer) {
p.pool.Put(buf)
}
var DefaultBufferPool *BufferPool
func init() {
DefaultBufferPool = NewBufferPool()
}
func Get() *bytes.Buffer {
return DefaultBufferPool.Get()
}
func Put(buf *bytes.Buffer) {
DefaultBufferPool.Put(buf)
}