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

Issue 5647051: code review 5647051: In json.NewDecoder: if the paramter is also a io.ByteRe...

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 2 months ago by Nan Deng
Modified:
12 years, 2 months ago
Reviewers:
r2, golang-dev
CC:
golang-dev, iant, rsc
Visibility:
Public.

Description

In json.NewDecoder: if the paramter is also a io.ByteReader, then only read one byte each time to avoid "over-feeding". Added a test case to test if the Decoder will over feeding. (Nearly a verbatim copy from jdnurmi@qwe.cc, the reporter of issue 1955) The performance using ReadByte on BenchmarkCodeDecoder is 1.6M/s; while the old version is about 1.65M/s. This change approximately hurts the performance by 4%. Test environment: - CPU: Intel(R) Core(TM) i5 CPU M 460 @ 2.53GHz - Memory: 6GB Fixes issue 1955

Patch Set 1 #

Patch Set 2 : diff -r 0eab3b57c894 https://go.googlecode.com/hg/ #

Patch Set 3 : diff -r 0eab3b57c894 https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+93 lines, -1 line) Patch
M src/pkg/encoding/json/decode_test.go View 1 1 chunk +14 lines, -0 lines 0 comments Download
M src/pkg/encoding/json/stream.go View 1 2 chunks +79 lines, -1 line 0 comments Download

Messages

Total messages: 4
Nan Deng
Hello golang-dev@googlegroups.com (cc: golang-dev@googlegroups.com, iant@golang.org, rsc@golang.org), I'd like you to review this change to https://go.googlecode.com/hg/
12 years, 2 months ago (2012-02-08 11:34:07 UTC) #1
r2
Maybe after Go 1. -rob
12 years, 2 months ago (2012-02-08 11:38:21 UTC) #2
rsc
I agree. This is a bigger change than I'm willing to make to such a ...
12 years, 2 months ago (2012-02-08 15:23:01 UTC) #3
Nan Deng
12 years, 2 months ago (2012-02-08 23:34:09 UTC) #4
Russ Cox wrote, On 02/08/2012 10:23 AM:
> I agree.  This is a bigger change than I'm willing
> to make to such a core package this close to Go 1.
> I will send out a CL to document the buffering for now.
> Please remind us about this CL after Go 1 is out.
>

Sure. I will send another mail to this thread after Go 1 is out. In the 
Meantime, I will keep optimizing the code to make it faster.

BTW, I am really exciting to hear that Go 1 is near. We are expecting it 
for (not too) long time.

Thanks,
-Nan
> Thanks.
> Russ
>

Sign in to reply to this message.

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