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

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

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 3 months ago by rick
Modified:
11 years, 2 months ago
Reviewers:
rsc, timo1, dave, bradfitz
CC:
golang-dev
Visibility:
Public.

Description

encoding/json: improve performance of Unmarshal on primitive types Skip most of the scanning and parsing logic for simple (non-object/array) JSON values. benchmark old ns/op new ns/op delta BenchmarkUnmarshalInt 948 436 -54.01% BenchmarkUnmarshalUint 930 427 -54.09% BenchmarkUnmarshalString 1407 715 -49.18% BenchmarkUnmarshalFloat 1114 536 -51.89% BenchmarkUnmarshalBool 759 266 -64.95% BenchmarkUnmarshalStruct 8165 8181 +0.20% No significant effects on the go1 benchmarks: benchmark old ns/op new ns/op delta BenchmarkBinaryTree17 9647362752 9596196417 -0.53% BenchmarkFannkuch11 5623613048 5518694872 -1.87% BenchmarkGobDecode 32944041 33165434 +0.67% BenchmarkGobEncode 21237482 21080554 -0.74% BenchmarkGzip 750955920 749861980 -0.15% BenchmarkGunzip 197369742 197886192 +0.26% BenchmarkJSONEncode 79274091 78891137 -0.48% BenchmarkJSONDecode 180257802 175280358 -2.76% BenchmarkMandelbrot200 7396666 7388266 -0.11% BenchmarkParse 11446460 11386550 -0.52% BenchmarkRevcomp 1605152523 1599512029 -0.35% BenchmarkTemplate 204538247 207765574 +1.58% benchmark old MB/s new MB/s speedup BenchmarkGobDecode 23.30 23.14 0.99x BenchmarkGobEncode 36.14 36.41 1.01x BenchmarkGzip 25.84 25.88 1.00x BenchmarkGunzip 98.32 98.06 1.00x BenchmarkJSONEncode 24.48 24.60 1.00x BenchmarkJSONDecode 10.76 11.07 1.03x BenchmarkParse 5.06 5.09 1.01x BenchmarkRevcomp 158.34 158.90 1.00x BenchmarkTemplate 9.49 9.34 0.98x Fixes issue 3949.

Patch Set 1 #

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

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

Total comments: 4

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

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

Patch Set 6 : diff -r fe640aeda5f2 https://code.google.com/p/go #

Total comments: 2

Patch Set 7 : diff -r fe640aeda5f2 https://code.google.com/p/go #

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

Messages

Total messages: 15
rick
Hello golang-dev@googlegroups.com, I'd like you to review this change to https://code.google.com/p/go
11 years, 3 months ago (2013-01-05 06:21:40 UTC) #1
dave_cheney.net
Awesome, can you also run a before/after for $GOROOT/test/bench/go1 ? https://codereview.appspot.com/7068043/diff/3001/src/pkg/encoding/json/decode.go File src/pkg/encoding/json/decode.go (right): https://codereview.appspot.com/7068043/diff/3001/src/pkg/encoding/json/decode.go#newcode58 ...
11 years, 3 months ago (2013-01-05 06:25:47 UTC) #2
rick
PTAL I updated the benchmark results and added go1 benchmarks to the description. https://codereview.appspot.com/7068043/diff/3001/src/pkg/encoding/json/decode.go File ...
11 years, 3 months ago (2013-01-05 15:40:55 UTC) #3
bradfitz
https://codereview.appspot.com/7068043/diff/3001/src/pkg/encoding/json/decode.go File src/pkg/encoding/json/decode.go (right): https://codereview.appspot.com/7068043/diff/3001/src/pkg/encoding/json/decode.go#newcode60 src/pkg/encoding/json/decode.go:60: if first > ' ' { this means you'll ...
11 years, 3 months ago (2013-01-09 23:16:38 UTC) #4
rick
https://codereview.appspot.com/7068043/diff/3001/src/pkg/encoding/json/decode.go File src/pkg/encoding/json/decode.go (right): https://codereview.appspot.com/7068043/diff/3001/src/pkg/encoding/json/decode.go#newcode60 src/pkg/encoding/json/decode.go:60: if first > ' ' { An error will ...
11 years, 3 months ago (2013-01-10 00:25:56 UTC) #5
rick
PTAL I did notice that cases with legitimate whitespace would throw an error and fixed ...
11 years, 3 months ago (2013-01-10 01:38:26 UTC) #6
bradfitz
thanks for the new tests. https://codereview.appspot.com/7068043/diff/8/src/pkg/encoding/json/decode.go File src/pkg/encoding/json/decode.go (right): https://codereview.appspot.com/7068043/diff/8/src/pkg/encoding/json/decode.go#newcode59 src/pkg/encoding/json/decode.go:59: var c byte drop ...
11 years, 3 months ago (2013-01-10 20:36:05 UTC) #7
timo1
> src/pkg/encoding/json/decode.go:59: var c byte > drop this variable? Or turn it around completely: // ...
11 years, 3 months ago (2013-01-10 22:07:44 UTC) #8
timo1
Very sorry, left my computer unlocked with 14 yr old around ... will not happen ...
11 years, 3 months ago (2013-01-10 22:25:21 UTC) #9
rick
PTAL https://codereview.appspot.com/7068043/diff/8/src/pkg/encoding/json/decode.go File src/pkg/encoding/json/decode.go (right): https://codereview.appspot.com/7068043/diff/8/src/pkg/encoding/json/decode.go#newcode59 src/pkg/encoding/json/decode.go:59: var c byte On 2013/01/10 20:36:05, bradfitz wrote: ...
11 years, 3 months ago (2013-01-10 22:50:50 UTC) #10
bradfitz
LGTM On Thu, Jan 10, 2013 at 2:50 PM, <rickarnoldjr@gmail.com> wrote: > PTAL > > ...
11 years, 3 months ago (2013-01-11 01:49:12 UTC) #11
bradfitz
(Submitted, but no email was sent?) On Thu, Jan 10, 2013 at 5:49 PM, Brad ...
11 years, 3 months ago (2013-01-11 02:03:14 UTC) #12
rick
On 2013/01/11 02:03:14, bradfitz wrote: > (Submitted, but no email was sent?) I did an ...
11 years, 3 months ago (2013-01-11 03:14:07 UTC) #13
dave_cheney.net
Use -D despite the helpful message. Code review thinks the CL is owner by someone ...
11 years, 3 months ago (2013-01-11 03:18:17 UTC) #14
rsc
11 years, 2 months ago (2013-01-29 21:08:48 UTC) #15
Message was sent while issue was closed.
This breaks unmarshaling of malformed data. I will roll it back and reopen the
issue.
Sign in to reply to this message.

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