Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1413)

Issue 7231058: code review 7231058: encoding/json: improve performance of Unmarshal on prim... (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 5 months ago by rick
Modified:
12 years, 5 months ago
Reviewers:
CC:
rsc, golang-dev
Visibility:
Public.

Description

encoding/json: improve performance of Unmarshal on primitive types Attempt 2. The first fix was much faster but ignored syntax errors. benchmark old ns/op new ns/op delta BenchmarkCodeEncoder 74993543 72982390 -2.68% BenchmarkCodeMarshal 77811181 75610637 -2.83% BenchmarkCodeDecoder 213337123 190144982 -10.87% BenchmarkCodeUnmarshal 212180972 190394852 -10.27% BenchmarkCodeUnmarshalReuse 202113428 182106660 -9.90% BenchmarkUnmarshalString 1343 919 -31.57% BenchmarkUnmarshalFloat64 1149 908 -20.97% BenchmarkUnmarshalInt64 967 778 -19.54% BenchmarkSkipValue 28851581 28414125 -1.52% benchmark old MB/s new MB/s speedup BenchmarkCodeEncoder 25.88 26.59 1.03x BenchmarkCodeMarshal 24.94 25.66 1.03x BenchmarkCodeDecoder 9.10 10.21 1.12x BenchmarkCodeUnmarshal 9.15 10.19 1.11x BenchmarkSkipValue 69.05 70.11 1.02x Fixes issue 3949.

Patch Set 1 #

Patch Set 2 : diff -r 715674f61ae8 https://code.google.com/p/go #

Patch Set 3 : diff -r 715674f61ae8 https://code.google.com/p/go #

Total comments: 2

Patch Set 4 : diff -r 715674f61ae8 https://code.google.com/p/go #

Total comments: 2

Patch Set 5 : diff -r 715674f61ae8 https://code.google.com/p/go #

Unified diffs Side-by-side diffs Delta from patch set Stats (+19 lines, -1 line) Patch
M src/pkg/encoding/json/decode.go View 1 2 3 4 1 chunk +19 lines, -1 line 0 comments Download

Messages

Total messages: 7
rick
Hello golang-dev@googlegroups.com, I'd like you to review this change to https://code.google.com/p/go
12 years, 5 months ago (2013-01-29 22:55:39 UTC) #1
rsc
https://codereview.appspot.com/7231058/diff/4001/src/pkg/encoding/json/decode.go File src/pkg/encoding/json/decode.go (right): https://codereview.appspot.com/7231058/diff/4001/src/pkg/encoding/json/decode.go#newcode78 src/pkg/encoding/json/decode.go:78: d := new(decodeState).init(data) Too much duplicated code. Please move ...
12 years, 5 months ago (2013-01-30 17:23:01 UTC) #2
rick
PTAL Benchmark numbers are within 2% of the previous patchset. https://codereview.appspot.com/7231058/diff/4001/src/pkg/encoding/json/decode.go File src/pkg/encoding/json/decode.go (right): https://codereview.appspot.com/7231058/diff/4001/src/pkg/encoding/json/decode.go#newcode78 ...
12 years, 5 months ago (2013-01-30 22:49:13 UTC) #3
rsc
https://codereview.appspot.com/7231058/diff/7001/src/pkg/encoding/json/decode.go File src/pkg/encoding/json/decode.go (right): https://codereview.appspot.com/7231058/diff/7001/src/pkg/encoding/json/decode.go#newcode82 src/pkg/encoding/json/decode.go:82: dp := new(decodeState).init(data) There's already one above: let's use ...
12 years, 5 months ago (2013-01-31 01:34:42 UTC) #4
rick
PTAL https://codereview.appspot.com/7231058/diff/7001/src/pkg/encoding/json/decode.go File src/pkg/encoding/json/decode.go (right): https://codereview.appspot.com/7231058/diff/7001/src/pkg/encoding/json/decode.go#newcode82 src/pkg/encoding/json/decode.go:82: dp := new(decodeState).init(data) On 2013/01/31 01:34:43, rsc wrote: ...
12 years, 5 months ago (2013-01-31 01:50:51 UTC) #5
rsc
LGTM
12 years, 5 months ago (2013-01-31 01:52:01 UTC) #6
rsc
12 years, 5 months ago (2013-01-31 01:53:51 UTC) #7
*** Submitted as https://code.google.com/p/go/source/detail?r=de89928ea00f ***

encoding/json: improve performance of Unmarshal on primitive types

Attempt 2. The first fix was much faster but ignored syntax errors.

benchmark                      old ns/op    new ns/op    delta
BenchmarkCodeEncoder            74993543     72982390   -2.68%
BenchmarkCodeMarshal            77811181     75610637   -2.83%
BenchmarkCodeDecoder           213337123    190144982  -10.87%
BenchmarkCodeUnmarshal         212180972    190394852  -10.27%
BenchmarkCodeUnmarshalReuse    202113428    182106660   -9.90%
BenchmarkUnmarshalString            1343          919  -31.57%
BenchmarkUnmarshalFloat64           1149          908  -20.97%
BenchmarkUnmarshalInt64              967          778  -19.54%
BenchmarkSkipValue              28851581     28414125   -1.52%

benchmark                       old MB/s     new MB/s  speedup
BenchmarkCodeEncoder               25.88        26.59    1.03x
BenchmarkCodeMarshal               24.94        25.66    1.03x
BenchmarkCodeDecoder                9.10        10.21    1.12x
BenchmarkCodeUnmarshal              9.15        10.19    1.11x
BenchmarkSkipValue                 69.05        70.11    1.02x

Fixes issue 3949.

R=rsc
CC=golang-dev
https://codereview.appspot.com/7231058

Committer: Russ Cox <rsc@golang.org>
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b