]> Cypherpunks repositories - gostls13.git/commit
fmt: optimize byte slice and array formatting for %v and %d
authorMartin Möhrmann <martisch@uos.de>
Thu, 3 Mar 2016 16:06:43 +0000 (17:06 +0100)
committerRob Pike <r@golang.org>
Sat, 5 Mar 2016 11:27:40 +0000 (11:27 +0000)
commit00da3a6ec30bbad224d483a8d23a3b8a516c8e97
treea3bb118c8642dd15ab80173415d7fd7c7b47f239
parent8c838192b84c062ccf208809320cab68d762a973
fmt: optimize byte slice and array formatting for %v and %d

Instead of calling printArg in fmtBytes to format each byte call
the byte formatting functions directly since it is known each
element is of type byte.

Add more tests for byte slice and array formatting.

name            old time/op  new time/op  delta
SprintfBytes-2   843ns ±16%   417ns ±11%  -50.58%  (p=0.000 n=20+20)

Change-Id: I5b907dbf52091e3de9710b09d67649c76f4c17e9
Reviewed-on: https://go-review.googlesource.com/20176
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
src/fmt/fmt_test.go
src/fmt/print.go