MCPcopy
hub / github.com/pquerna/ffjson / makeSlice

Function makeSlice

fflib/v1/buffer_pool.go:93–105  ·  view source on GitHub ↗

makeSlice allocates a slice of size n -- it will attempt to use a pool'ed instance whenever possible.

(n int)

Source from the content-addressed store, hash-verified

91// makeSlice allocates a slice of size n -- it will attempt to use a pool'ed
92// instance whenever possible.
93func makeSlice(n int) []byte {
94 if n <= 64 {
95 return pool64.Get().([]byte)[0:n]
96 }
97
98 pn := poolNum(n)
99
100 if pn != -1 {
101 return pools[pn].Get().([]byte)[0:n]
102 } else {
103 return make([]byte, n)
104 }
105}

Callers 3

growMethod · 0.70
ReadFromMethod · 0.70
FormatBits2Function · 0.70

Calls 1

poolNumFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…