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)
| 456 | // strconv.AppendInt with a byte slice taken from a sync.Pool to avoid |
| 457 | // allocations. |
| 458 | func 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 | } |
no test coverage detected