DescriptionIn 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/ #
MessagesTotal messages: 4
|