fmt: optimize %x and %X formatting for byte slices and strings
No extra buffering is needed to save the encoding since the left padding can be computed and written out before the encoding is generated. Add extra tests to both string and byte slice formatting. name old time/op new time/op delta SprintfHexString-2 410ns ± 3% 194ns ± 3% -52.60% (p=0.000 n=20+19) SprintfHexBytes-2 431ns ± 3% 202ns ± 2% -53.13% (p=0.000 n=18+20) Change-Id: Ibca4316427c89f834e4faee61614493c7eedb42b Reviewed-on: https://go-review.googlesource.com/20097 Run-TryBot: Rob Pike <r@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rob Pike <r@golang.org>
Showing
Please register or sign in to comment