aboutsummaryrefslogtreecommitdiff
path: root/src/encoding/json/encode.go
diff options
context:
space:
mode:
authorDaniel Martí <mvdan@mvdan.cc>2018-11-25 23:02:28 +0000
committerDaniel Martí <mvdan@mvdan.cc>2019-03-05 17:40:09 +0000
commita563f2f4177e6b3b897ae0a1c452e53ffc245638 (patch)
treedeca33b83c068345056e30f5de547e77e7a17eeb /src/encoding/json/encode.go
parentebdc24c3d334132542daa7c57246389e0b259227 (diff)
downloadgo-a563f2f4177e6b3b897ae0a1c452e53ffc245638.tar.xz
encoding/hex: simplify encoder arithmetic
Two additions are faster than two multiplications and one addition. The code seems simpler to me too, as it's more obvious that we advance two destination bytes for each source byte. name old time/op new time/op delta Encode/256-8 374ns ± 0% 331ns ± 0% -11.44% (p=0.008 n=5+5) Encode/1024-8 1.47µs ± 0% 1.29µs ± 0% -11.89% (p=0.004 n=6+5) Encode/4096-8 5.85µs ± 1% 5.15µs ± 0% -11.89% (p=0.004 n=6+5) Encode/16384-8 23.3µs ± 0% 20.6µs ± 0% -11.68% (p=0.004 n=6+5) Change-Id: Iabc63616c1d9fded55fa668ff41dd49efeaa2ea4 Reviewed-on: https://go-review.googlesource.com/c/go/+/151198 Run-TryBot: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: roger peppe <rogpeppe@gmail.com>
Diffstat (limited to 'src/encoding/json/encode.go')
0 files changed, 0 insertions, 0 deletions