MCPcopy Create free account
hub / github.com/prometheus/common / writeInt

Function writeInt

expfmt/text_create.go:458–464  ·  view source on GitHub ↗

writeInt is equivalent to fmt.Fprint with an int64 argument but uses strconv.AppendInt with a byte slice taken from a sync.Pool to avoid allocations.

(w enhancedWriter, i int64)

Source from the content-addressed store, hash-verified

456// strconv.AppendInt with a byte slice taken from a sync.Pool to avoid
457// allocations.
458func writeInt(w enhancedWriter, i int64) (int, error) {
459 bp := numBufPool.Get().(*[]byte)
460 *bp = strconv.AppendInt((*bp)[:0], i, 10)
461 written, err := w.Write(*bp)
462 numBufPool.Put(bp)
463 return written, err
464}

Callers 1

writeSampleFunction · 0.85

Calls 2

GetMethod · 0.80
PutMethod · 0.80

Tested by

no test coverage detected