Implementation now constructs a string using strings.Builder and then converts it to []byte (causing an allocation and copy) before passing it to r.AddData. Since r.AddData accepts []byte, we can build the byte slice directly using bytes.Buffer, avoiding the intermediate string allocation
Solution: Replaced strings.Builder with bytes.Buffer in FormatNsenterInfo function.
Impact:
~10% reduction in execution time
~10% reduction in memory allocations
2 fewer allocations per operation (14 -> 12)
file: pkg/unikontainers/unikontainers.go
Implementation now constructs a string using strings.Builder and then converts it to []byte (causing an allocation and copy) before passing it to r.AddData. Since r.AddData accepts []byte, we can build the byte slice directly using bytes.Buffer, avoiding the intermediate string allocation
Solution: Replaced strings.Builder with bytes.Buffer in FormatNsenterInfo function.
Impact:
~10% reduction in execution time
~10% reduction in memory allocations
2 fewer allocations per operation (14 -> 12)
file: pkg/unikontainers/unikontainers.go