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

Issue 13894045: code review 13894045: encoding/json: speed up decoding (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 6 months ago by bradfitz
Modified:
10 years, 3 months ago
Reviewers:
r, adg, mikio, dvyukov
CC:
golang-dev, rsc, adg, r, mikio
Visibility:
Public.

Description

encoding/json: speed up decoding Don't make copies of keys while decoding, and don't use the expensive strings.EqualFold when it's not necessary. Instead, note in the existing field cache what algorithm to use to check fold equality... most keys are just ASCII letters. benchmark old ns/op new ns/op delta BenchmarkCodeDecoder 137074314 103974418 -24.15% benchmark old MB/s new MB/s speedup BenchmarkCodeDecoder 14.16 18.66 1.32x Update Issue 6496

Patch Set 1 #

Patch Set 2 : diff -r 351b6fe0ae36 https://go.googlecode.com/hg/ #

Patch Set 3 : diff -r 351b6fe0ae36 https://go.googlecode.com/hg/ #

Patch Set 4 : diff -r 351b6fe0ae36 https://go.googlecode.com/hg/ #

Patch Set 5 : diff -r 351b6fe0ae36 https://go.googlecode.com/hg/ #

Total comments: 16

Patch Set 6 : diff -r 878fc73cc5e4 https://go.googlecode.com/hg/ #

Total comments: 4

Patch Set 7 : diff -r 878fc73cc5e4 https://go.googlecode.com/hg/ #

Total comments: 4

Patch Set 8 : diff -r 878fc73cc5e4 https://go.googlecode.com/hg/ #

Total comments: 5

Patch Set 9 : diff -r 38b64a8de1a5 https://go.googlecode.com/hg/ #

Patch Set 10 : diff -r 38b64a8de1a5 https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+282 lines, -8 lines) Patch
M src/pkg/encoding/json/decode.go View 1 4 chunks +5 lines, -5 lines 0 comments Download
M src/pkg/encoding/json/encode.go View 1 2 3 4 chunks +18 lines, -3 lines 0 comments Download
A src/pkg/encoding/json/fold.go View 1 2 3 4 5 6 7 8 1 chunk +143 lines, -0 lines 0 comments Download
A src/pkg/encoding/json/fold_test.go View 1 2 3 4 5 6 7 8 1 chunk +116 lines, -0 lines 0 comments Download

Messages

Total messages: 28
bradfitz
Hello golang-dev@googlegroups.com, I'd like you to review this change to https://go.googlecode.com/hg/
10 years, 6 months ago (2013-09-25 17:03:40 UTC) #1
rsc
I haven't fully grokked this yet, but it sounds like you are assuming that if ...
10 years, 6 months ago (2013-09-25 17:12:11 UTC) #2
bradfitz
On Wed, Sep 25, 2013 at 10:12 AM, Russ Cox <rsc@golang.org> wrote: > I haven't ...
10 years, 6 months ago (2013-09-25 17:25:35 UTC) #3
bradfitz
Hello golang-dev@googlegroups.com, rsc@golang.org (cc: golang-dev@googlegroups.com), Please take another look.
10 years, 6 months ago (2013-09-25 18:10:29 UTC) #4
adg
Please "hg upload" again, getting "old chunk mismatch"
10 years, 6 months ago (2013-09-26 00:12:22 UTC) #5
rsc
Please hold off until after Go 1.2
10 years, 6 months ago (2013-09-26 00:45:22 UTC) #6
bradfitz
PTAL now that Go 1.2 is out
10 years, 4 months ago (2013-12-18 00:17:52 UTC) #7
adg
LGTM but I'm not a unicode expert Remove "Probably too late for Go 1.2, but ...
10 years, 4 months ago (2013-12-18 04:22:14 UTC) #8
r
https://codereview.appspot.com/13894045/diff/25001/src/pkg/encoding/json/fold.go File src/pkg/encoding/json/fold.go (right): https://codereview.appspot.com/13894045/diff/25001/src/pkg/encoding/json/fold.go#newcode19 src/pkg/encoding/json/fold.go:19: // 4) simpleLetterEqualFold, if s is all simple (not ...
10 years, 4 months ago (2013-12-18 04:35:30 UTC) #9
bradfitz
https://codereview.appspot.com/13894045/diff/25001/src/pkg/encoding/json/fold.go File src/pkg/encoding/json/fold.go (right): https://codereview.appspot.com/13894045/diff/25001/src/pkg/encoding/json/fold.go#newcode19 src/pkg/encoding/json/fold.go:19: // 4) simpleLetterEqualFold, if s is all simple (not ...
10 years, 4 months ago (2013-12-18 05:24:13 UTC) #10
bradfitz
Hello golang-dev@googlegroups.com, rsc@golang.org, adg@golang.org, r@golang.org (cc: golang-dev@googlegroups.com), Please take another look.
10 years, 4 months ago (2013-12-18 05:24:31 UTC) #11
bradfitz
PTAL Updated numbers in CL description, best of three runs each (but not very variable) ...
10 years, 4 months ago (2013-12-18 05:51:30 UTC) #12
mikio
lgtm https://codereview.appspot.com/13894045/diff/27001/src/pkg/encoding/json/fold.go File src/pkg/encoding/json/fold.go (right): https://codereview.appspot.com/13894045/diff/27001/src/pkg/encoding/json/fold.go#newcode1 src/pkg/encoding/json/fold.go:1: // Copyright 2013 The Go Authors. All rights ...
10 years, 4 months ago (2013-12-18 06:04:07 UTC) #13
bradfitz
PTAL https://codereview.appspot.com/13894045/diff/27001/src/pkg/encoding/json/fold.go File src/pkg/encoding/json/fold.go (right): https://codereview.appspot.com/13894045/diff/27001/src/pkg/encoding/json/fold.go#newcode1 src/pkg/encoding/json/fold.go:1: // Copyright 2013 The Go Authors. All rights ...
10 years, 4 months ago (2013-12-18 06:17:51 UTC) #14
r
i might be missing something but consider my approach https://codereview.appspot.com/13894045/diff/47001/src/pkg/encoding/json/fold.go File src/pkg/encoding/json/fold.go (right): https://codereview.appspot.com/13894045/diff/47001/src/pkg/encoding/json/fold.go#newcode64 src/pkg/encoding/json/fold.go:64: ...
10 years, 4 months ago (2013-12-18 07:04:22 UTC) #15
r
obviously there's an "else continue" missing in the ascii case. On Tue, Dec 17, 2013 ...
10 years, 4 months ago (2013-12-18 07:05:39 UTC) #16
bradfitz
Hello golang-dev@googlegroups.com, rsc@golang.org, adg@golang.org, r@golang.org, mikioh.mikioh@gmail.com (cc: golang-dev@googlegroups.com), Please take another look.
10 years, 4 months ago (2013-12-18 11:40:25 UTC) #17
bradfitz
https://codereview.appspot.com/13894045/diff/47001/src/pkg/encoding/json/fold.go File src/pkg/encoding/json/fold.go (right): https://codereview.appspot.com/13894045/diff/47001/src/pkg/encoding/json/fold.go#newcode64 src/pkg/encoding/json/fold.go:64: switch sb { On 2013/12/18 07:04:23, r wrote: > ...
10 years, 4 months ago (2013-12-18 11:40:27 UTC) #18
r
https://codereview.appspot.com/13894045/diff/67001/src/pkg/encoding/json/fold.go File src/pkg/encoding/json/fold.go (right): https://codereview.appspot.com/13894045/diff/67001/src/pkg/encoding/json/fold.go#newcode90 src/pkg/encoding/json/fold.go:90: t = t[size:] this line is unreachable https://codereview.appspot.com/13894045/diff/67001/src/pkg/encoding/json/fold_test.go File ...
10 years, 4 months ago (2013-12-18 14:47:54 UTC) #19
bradfitz
https://codereview.appspot.com/13894045/diff/67001/src/pkg/encoding/json/fold.go File src/pkg/encoding/json/fold.go (right): https://codereview.appspot.com/13894045/diff/67001/src/pkg/encoding/json/fold.go#newcode90 src/pkg/encoding/json/fold.go:90: t = t[size:] On 2013/12/18 14:47:54, r wrote: > ...
10 years, 4 months ago (2013-12-18 14:49:34 UTC) #20
r
https://codereview.appspot.com/13894045/diff/67001/src/pkg/encoding/json/fold.go File src/pkg/encoding/json/fold.go (right): https://codereview.appspot.com/13894045/diff/67001/src/pkg/encoding/json/fold.go#newcode90 src/pkg/encoding/json/fold.go:90: t = t[size:] right, got it.
10 years, 4 months ago (2013-12-18 14:53:25 UTC) #21
bradfitz
Hello golang-dev@googlegroups.com, rsc@golang.org, adg@golang.org, r@golang.org, mikioh.mikioh@gmail.com (cc: golang-dev@googlegroups.com), Please take another look.
10 years, 4 months ago (2013-12-18 15:21:07 UTC) #22
bradfitz
https://codereview.appspot.com/13894045/diff/67001/src/pkg/encoding/json/fold_test.go File src/pkg/encoding/json/fold_test.go (right): https://codereview.appspot.com/13894045/diff/67001/src/pkg/encoding/json/fold_test.go#newcode37 src/pkg/encoding/json/fold_test.go:37: {asciiEqualFold, "aa@", "aa`", false}, // verify 0x40 and 0x60 ...
10 years, 4 months ago (2013-12-18 15:21:23 UTC) #23
bradfitz
On Wed, Dec 18, 2013 at 7:21 PM, <bradfitz@golang.org> wrote: > > https://codereview.appspot.com/13894045/diff/67001/src/ > pkg/encoding/json/fold_test.go ...
10 years, 4 months ago (2013-12-18 15:22:05 UTC) #24
r
LGTM
10 years, 4 months ago (2013-12-18 15:22:33 UTC) #25
bradfitz
*** Submitted as https://code.google.com/p/go/source/detail?r=28a4d13557a9 *** encoding/json: speed up decoding Don't make copies of keys while ...
10 years, 4 months ago (2013-12-18 15:30:27 UTC) #26
dvyukov
FYI, effects on json benchmark: http://goperfd.appspot.com/perfdetail?commit=28a4d13557a99de31746a59fd0d07ddcfeed351b&builder=windows-amd64&benchmark=json
10 years, 4 months ago (2013-12-20 09:00:37 UTC) #27
bradfitz
10 years, 4 months ago (2013-12-20 09:41:22 UTC) #28
Fun.



On Fri, Dec 20, 2013 at 1:00 AM, <dvyukov@google.com> wrote:

> FYI, effects on json benchmark:
>
> http://goperfd.appspot.com/perfdetail?commit=
> 28a4d13557a99de31746a59fd0d07ddcfeed351b&builder=windows-
> amd64&benchmark=json
>
>
>
> https://codereview.appspot.com/13894045/
>
Sign in to reply to this message.

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