mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-18 14:40:26 +01:00
498fe1cfa5
This optimization is no longer needed according to benchmarks with ingestion rate. This simplifies the code a bit.
26 lines
454 B
Go
26 lines
454 B
Go
package netstorage
|
|
|
|
import (
|
|
"sync"
|
|
)
|
|
|
|
// GetInsertCtx returns InsertCtx from the pool.
|
|
//
|
|
// Call PutInsertCtx for returning it to the pool.
|
|
func GetInsertCtx() *InsertCtx {
|
|
if v := insertCtxPool.Get(); v != nil {
|
|
return v.(*InsertCtx)
|
|
}
|
|
return &InsertCtx{}
|
|
}
|
|
|
|
// PutInsertCtx returns ctx to the pool.
|
|
//
|
|
// ctx cannot be used after the call.
|
|
func PutInsertCtx(ctx *InsertCtx) {
|
|
ctx.Reset()
|
|
insertCtxPool.Put(ctx)
|
|
}
|
|
|
|
var insertCtxPool sync.Pool
|