mirror of
https://github.com/golang/go
synced 2024-11-19 06:24:41 -07:00
c226f6432d
The byte-at-a-time allocation done quoting strings in appendQuotedWith grows the output incrementally, which is poor behavior for very large strings. An easy fix is to make sure the buffer has enough room at least for an unquoted string. Add a benchmark with a megabyte of non-ASCII data. Before: 39 allocations. After: 7 allocations. We could do better by doing a lot more work but this seems like a big result for little effort. Fixes #31472. Change-Id: I852139e0a2bd13722c4dd329ded8ae1759abad5b Reviewed-on: https://go-review.googlesource.com/c/go/+/172677 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> |
||
---|---|---|
.. | ||
testdata | ||
atob_test.go | ||
atob.go | ||
atof_test.go | ||
atof.go | ||
atoi_test.go | ||
atoi.go | ||
decimal_test.go | ||
decimal.go | ||
doc.go | ||
example_test.go | ||
export_test.go | ||
extfloat.go | ||
fp_test.go | ||
ftoa_test.go | ||
ftoa.go | ||
internal_test.go | ||
isprint.go | ||
itoa_test.go | ||
itoa.go | ||
makeisprint.go | ||
quote_test.go | ||
quote.go | ||
strconv_test.go |