1
0
mirror of https://github.com/golang/go synced 2024-11-17 21:34:49 -07:00
go/src/encoding/json
codesoap a1103dcc27 encoding/json: consolidate the isSpace function
The new code is easier to read, and practically equivalent in terms of
performance.

	name                  old time/op    new time/op    delta
	CodeUnmarshal-2          166ms ± 1%     166ms ± 1%    ~     (p=0.863 n=11+10)
	CodeUnmarshalReuse-2     139ms ± 1%     139ms ± 1%    ~     (p=0.050 n=10+12)
	UnmarshalString-2       1.08µs ± 1%    1.07µs ± 1%  -0.64%  (p=0.001 n=10+11)
	UnmarshalFloat64-2      1.01µs ± 1%    1.01µs ± 1%    ~     (p=0.280 n=12+11)
	UnmarshalInt64-2         850ns ± 0%     851ns ± 0%    ~     (p=0.455 n=11+12)

	name                  old speed      new speed      delta
	CodeUnmarshal-2       11.7MB/s ± 1%  11.7MB/s ± 1%    ~     (p=0.904 n=11+10)
	CodeUnmarshalReuse-2  14.0MB/s ± 1%  14.0MB/s ± 1%  +0.40%  (p=0.041 n=10+12)

	name                  old alloc/op   new alloc/op   delta
	CodeUnmarshal-2         3.28MB ± 0%    3.28MB ± 0%    ~     (p=0.907 n=10+11)
	CodeUnmarshalReuse-2    2.19MB ± 0%    2.19MB ± 0%    ~     (p=0.306 n=12+12)
	UnmarshalString-2         192B ± 0%      192B ± 0%    ~     (all equal)
	UnmarshalFloat64-2        180B ± 0%      180B ± 0%    ~     (all equal)
	UnmarshalInt64-2          176B ± 0%      176B ± 0%    ~     (all equal)

	name                  old allocs/op  new allocs/op  delta
	CodeUnmarshal-2          92.7k ± 0%     92.7k ± 0%    ~     (all equal)
	CodeUnmarshalReuse-2     80.4k ± 0%     80.4k ± 0%    ~     (all equal)
	UnmarshalString-2         2.00 ± 0%      2.00 ± 0%    ~     (all equal)
	UnmarshalFloat64-2        2.00 ± 0%      2.00 ± 0%    ~     (all equal)
	UnmarshalInt64-2          1.00 ± 0%      1.00 ± 0%    ~     (all equal)

Change-Id: I6d5a48c624d436551409a17c21542e26d29e26b3
GitHub-Last-Rev: 7d81961688
GitHub-Pull-Request: golang/go#37385
Reviewed-on: https://go-review.googlesource.com/c/go/+/220581
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Joe Tsai <joetsai@google.com>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-02-26 17:58:41 +00:00
..
testdata
bench_test.go encoding/json: improve performance of Compact 2019-10-27 16:02:29 +00:00
decode_test.go encoding/json: limit max nesting depth 2020-02-24 14:35:19 +00:00
decode.go encoding/json: avoid work when unquoting strings, take 2 2019-10-31 12:02:57 +00:00
encode_test.go encoding/json: error when encoding a pointer cycle 2019-11-11 16:24:21 +00:00
encode.go encoding/json: fix broken link to json.org 2020-02-22 17:39:09 +00:00
example_marshaling_test.go
example_test.go
example_text_marshaling_test.go
fold_test.go
fold.go
fuzz.go encoding/json: fix format string in the Fuzz func 2019-08-18 01:16:33 +00:00
indent.go encoding/json: improve performance of Compact 2019-10-27 16:02:29 +00:00
number_test.go
scanner_test.go encoding/json: stop escaping U+2028 and U+2029 in Compact 2019-10-10 11:31:54 +00:00
scanner.go encoding/json: consolidate the isSpace function 2020-02-26 17:58:41 +00:00
stream_test.go encoding/json: fix and optimize marshal for quoted string 2019-09-11 12:26:35 +00:00
stream.go encoding/json: add Decoder.InputOffset for offset access 2019-10-11 16:34:01 +00:00
tables.go
tagkey_test.go
tags_test.go
tags.go