]> Cypherpunks repositories - gostls13.git/commit
json: use strconv.Append variants to avoid allocations in encoding
authorBrad Fitzpatrick <bradfitz@golang.org>
Thu, 15 Dec 2011 19:21:21 +0000 (11:21 -0800)
committerBrad Fitzpatrick <bradfitz@golang.org>
Thu, 15 Dec 2011 19:21:21 +0000 (11:21 -0800)
commit29264c6f4f341586b733e2c5b165ca627b6050d8
treeb8e068d54ec1828b5e2f1901e4b53563434d0e8c
parent143f3b38f5fe48d33bff8f76728739694b3e060f
json: use strconv.Append variants to avoid allocations in encoding

Before/after, best of 3:
json.BenchmarkCodeEncoder  10  183495300 ns/op  10.58 MB/s
->
json.BenchmarkCodeEncoder  10  133025100 ns/op  14.59 MB/s

But don't get too excited about this.  These benchmarks, while
stable at any point of time, fluctuate wildly with any line of
code added or removed anywhere in the path due to stack splitting
issues.

It's currently much faster, though, and this is the API that
doesn't allocate so should always be faster in theory.

R=golang-dev, dsymonds, rsc, r, gri
CC=golang-dev
https://golang.org/cl/5411052
src/pkg/encoding/json/encode.go