ax(mining): replace prose comment with usage example on bufferPool
AX Principle 2: comments show HOW via concrete call, not WHAT via prose. The previous comment described the variable's purpose in prose — replaced with a direct usage example showing the Get/Reset/Put pattern. Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
parent
f086c767ab
commit
ddb24545b9
1 changed files with 1 additions and 2 deletions
|
|
@ -6,8 +6,7 @@ import (
|
|||
"sync"
|
||||
)
|
||||
|
||||
// bufferPool provides reusable byte buffers for JSON encoding.
|
||||
// This reduces allocation overhead in hot paths like WebSocket event serialization.
|
||||
// buf := bufferPool.Get().(*bytes.Buffer); buf.Reset(); defer bufferPool.Put(buf)
|
||||
var bufferPool = sync.Pool{
|
||||
New: func() interface{} {
|
||||
return bytes.NewBuffer(make([]byte, 0, 1024))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue