You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
strconv.AppendFloat, and, strconv.AppendInt avoid heap allocations, lowering
the memory pressure, hence suitable for tight loops. Except that, it does
appen() on the input byte-slice hence the slice itself escapes to heap. So
there is still 1 allocation that can't be avoided.
In case of CollateIint64 and CollateFloat64, there is an allocation for each call to AppendFloat/AppendInt.
Above benchmarks are on data that has integers and floats. So, we can't have a true ZERO allocation API to convert float to string and int to string.
BenchmarkVal2CollMap 50000 26696 ns/op 16416 B/op 2 allocs/op
BenchmarkVal2CollTyp 10000 174548 ns/op 49250 B/op 6 allocs/op
BenchmarkJson2CollStr 2000 635015 ns/op 1048647 B/op 5 allocs/op
BenchmarkCbor2CollMap 2000 787087 ns/op 1089654 B/op 8 allocs/op
BenchmarkCbor2CollTyp 500 2500523 ns/op 3269067 B/op 25 allocs/op
The text was updated successfully, but these errors were encountered: