MCPcopy
hub / github.com/grpc/grpc-go / getPool

Method getPool

internal/mem/buffer_pool.go:288–298  ·  view source on GitHub ↗
(size int)

Source from the content-addressed store, hash-verified

286}
287
288func (p *TieredBufferPool) getPool(size int) bufferPool {
289 poolIdx := sort.Search(len(p.sizedPools), func(i int) bool {
290 return p.sizedPools[i].defaultSize >= size
291 })
292
293 if poolIdx == len(p.sizedPools) {
294 return &p.fallbackPool
295 }
296
297 return p.sizedPools[poolIdx]
298}
299
300// SimpleBufferPool is an implementation of the mem.BufferPool interface that
301// attempts to pool buffers with a sync.Pool. When Get is invoked, it tries to

Callers 3

GetMethod · 0.95
PutMethod · 0.95
BenchmarkTieredPoolFunction · 0.95

Calls 1

SearchMethod · 0.65

Tested by 1

BenchmarkTieredPoolFunction · 0.76