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

Issue 12521043: code review 12521043: encoding/binary: Reduce memory allocations and add fast... (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 10 months ago by Hierro
Modified:
11 years, 10 months ago
Reviewers:
r, rsc, iant, golang-dev
CC:
golang-dev
Visibility:
Public.

Description

encoding/binary: Reduce memory allocations and add fast paths for slices Also added a new test and a few benchmarks for different basic slice types. Fixes issue 2634 benchmark old ns/op new ns/op delta BenchmarkReadSlice1000Int8s 35700 3328 -90.68% BenchmarkReadSlice1000Uint8s 34159 110 -99.68% BenchmarkReadSlice1000Int16s 46197 14607 -68.38% BenchmarkReadSlice1000Uint16s 44314 14693 -66.84% BenchmarkReadSlice1000Int32s 49191 19269 -60.83% BenchmarkReadSlice1000Uint32s 47523 18213 -61.68% BenchmarkReadSlice1000Int64s 61243 29637 -51.61% BenchmarkReadSlice1000Uint64s 57205 27828 -51.35% BenchmarkWriteSlice1000Int8s 40406 2217 -94.51% BenchmarkWriteSlice1000Uint8s 40316 99 -99.75% BenchmarkWriteSlice1000Int16s 51168 11912 -76.72% BenchmarkWriteSlice1000Uint16s 49556 11840 -76.11% BenchmarkWriteSlice1000Int32s 54567 15955 -70.76% BenchmarkWriteSlice1000Uint32s 51732 15800 -69.46% BenchmarkWriteSlice1000Int64s 67872 24318 -64.17% BenchmarkWriteSlice1000Uint64s 61171 23469 -61.63% benchmark old MB/s new MB/s speedup BenchmarkReadSlice1000Int8s 28.01 300.41 10.73x BenchmarkReadSlice1000Uint8s 29.27 9051.21 309.23x BenchmarkReadSlice1000Int16s 43.29 136.92 3.16x BenchmarkReadSlice1000Uint16s 45.13 136.11 3.02x BenchmarkReadSlice1000Int32s 81.31 207.58 2.55x BenchmarkReadSlice1000Uint32s 84.17 219.61 2.61x BenchmarkReadSlice1000Int64s 130.63 269.93 2.07x BenchmarkReadSlice1000Uint64s 139.85 287.48 2.06x BenchmarkWriteSlice1000Int8s 24.75 451.01 18.22x BenchmarkWriteSlice1000Uint8s 24.80 10104.20 407.43x BenchmarkWriteSlice1000Int16s 39.09 167.89 4.29x BenchmarkWriteSlice1000Uint16s 40.36 168.91 4.19x BenchmarkWriteSlice1000Int32s 73.30 250.70 3.42x BenchmarkWriteSlice1000Uint32s 77.32 253.16 3.27x BenchmarkWriteSlice1000Int64s 117.87 328.97 2.79x BenchmarkWriteSlice1000Uint64s 130.78 340.87 2.61x benchmark old allocs new allocs delta BenchmarkReadSlice1000Int8s 2 1 -50.00% BenchmarkReadSlice1000Uint8s 2 1 -50.00% BenchmarkReadSlice1000Int16s 2 1 -50.00% BenchmarkReadSlice1000Uint16s 2 1 -50.00% BenchmarkReadSlice1000Int32s 2 1 -50.00% BenchmarkReadSlice1000Uint32s 2 1 -50.00% BenchmarkReadSlice1000Int64s 2 1 -50.00% BenchmarkReadSlice1000Uint64s 2 1 -50.00% BenchmarkWriteSlice1000Int8s 3 1 -66.67% BenchmarkWriteSlice1000Uint8s 3 1 -66.67% BenchmarkWriteSlice1000Int16s 3 1 -66.67% BenchmarkWriteSlice1000Uint16s 3 1 -66.67% BenchmarkWriteSlice1000Int32s 3 1 -66.67% BenchmarkWriteSlice1000Uint32s 3 1 -66.67% BenchmarkWriteSlice1000Int64s 3 1 -66.67% BenchmarkWriteSlice1000Uint64s 3 1 -66.67% benchmark old bytes new bytes delta BenchmarkReadSlice1000Int8s 1072 8 -99.25% BenchmarkReadSlice1000Uint8s 1072 8 -99.25% BenchmarkReadSlice1000Int16s 2096 8 -99.62% BenchmarkReadSlice1000Uint16s 2096 8 -99.62% BenchmarkReadSlice1000Int32s 4144 8 -99.81% BenchmarkReadSlice1000Uint32s 4144 8 -99.81% BenchmarkReadSlice1000Int64s 8240 8 -99.90% BenchmarkReadSlice1000Uint64s 8240 8 -99.90% BenchmarkWriteSlice1000Int8s 1080 8 -99.26% BenchmarkWriteSlice1000Uint8s 1080 8 -99.26% BenchmarkWriteSlice1000Int16s 2104 8 -99.62% BenchmarkWriteSlice1000Uint16s 2104 8 -99.62% BenchmarkWriteSlice1000Int32s 4152 8 -99.81% BenchmarkWriteSlice1000Uint32s 4152 8 -99.81% BenchmarkWriteSlice1000Int64s 8248 8 -99.90% BenchmarkWriteSlice1000Uint64s 8248 8 -99.90%

Patch Set 1 #

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

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

Total comments: 2

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

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

Unified diffs Side-by-side diffs Delta from patch set Stats (+708 lines, -96 lines) Patch
M src/pkg/encoding/binary/binary.go View 1 2 3 11 chunks +563 lines, -84 lines 0 comments Download
M src/pkg/encoding/binary/binary_test.go View 1 2 3 3 chunks +145 lines, -12 lines 0 comments Download

Messages

Total messages: 16
Hierro
Hello golang-dev@googlegroups.com, I'd like you to review this change to https://code.google.com/p/go
11 years, 10 months ago (2013-08-06 10:24:39 UTC) #1
r
This is too complicated and pulls in too much. All that's required is a few ...
11 years, 10 months ago (2013-08-06 10:46:00 UTC) #2
Hierro
On 2013/08/06 10:46:00, r wrote: > This is too complicated and pulls in too much. ...
11 years, 10 months ago (2013-08-06 11:57:29 UTC) #3
r
I think one of us isn't listening. It may be me, but I was expecting ...
11 years, 10 months ago (2013-08-06 12:13:39 UTC) #4
Hierro
On 2013/08/06 12:13:39, r wrote: > I think one of us isn't listening. It may ...
11 years, 10 months ago (2013-08-06 14:51:51 UTC) #5
Hierro
Hello golang-dev@googlegroups.com, r@golang.org (cc: golang-dev@googlegroups.com), Please take another look.
11 years, 10 months ago (2013-08-06 23:28:11 UTC) #6
r
I apologize but your goals for this package seem to be different from ours. You've ...
11 years, 10 months ago (2013-08-09 06:17:50 UTC) #7
Hierro
On 2013/08/09 06:17:50, r wrote: > I apologize but your goals for this package seem ...
11 years, 10 months ago (2013-08-09 10:04:50 UTC) #8
Hierro
*** Abandoned ***
11 years, 10 months ago (2013-08-09 10:16:43 UTC) #9
iant
On Fri, Aug 9, 2013 at 3:04 AM, <alberto.garcia.hierro@gmail.com> wrote: > > Anyway, if your ...
11 years, 10 months ago (2013-08-09 13:13:52 UTC) #10
Hierro
On 2013/08/09 13:13:52, iant wrote: > On Fri, Aug 9, 2013 at 3:04 AM, <mailto:alberto.garcia.hierro@gmail.com> ...
11 years, 10 months ago (2013-08-09 16:59:20 UTC) #11
iant
On Fri, Aug 9, 2013 at 9:59 AM, <alberto.garcia.hierro@gmail.com> wrote: > On 2013/08/09 13:13:52, iant ...
11 years, 10 months ago (2013-08-09 17:29:37 UTC) #12
Hierro
On 2013/08/09 17:29:37, iant wrote: > On Fri, Aug 9, 2013 at 9:59 AM, <mailto:alberto.garcia.hierro@gmail.com> ...
11 years, 10 months ago (2013-08-09 18:31:25 UTC) #13
rsc
Alberto, You seem singularly focused on performance, willing to go to great lengths to get ...
11 years, 10 months ago (2013-08-09 18:33:55 UTC) #14
Hierro
On 2013/08/09 18:33:55, rsc wrote: Hi Russ, My focus for this package is indeed performance, ...
11 years, 10 months ago (2013-08-10 16:13:14 UTC) #15
r
11 years, 10 months ago (2013-08-10 23:31:56 UTC) #16
Those numbers are impressive.

I am sorry you feel frustrated and especially sorry you feel you
wasted time talking to us. But as contribute.html tries to make clear,
it's better to discuss your design before coding, not once the code is
already written:

"Before undertaking to write something new for the Go project, send
mail to the mailing list to discuss what you plan to do. This gives
everyone a chance to validate the design, helps prevent duplication of
effort, and ensures that the idea fits inside the goals for the
language and tools. It also guarantees that the design is sound before
code is written; the code review tool is not the place for high-level
discussions."

We spent a lot of time at cross-purposes within the code review
process, even as the code was being actively developed. With some
conversation up front, much of that could have been avoided. The
process did let you down, but I feel it could have gone better. The
end result might have been the same, but it would at least have been
more efficient for all concerned.

I say this in the manner of a post-mortem, a lesson for us and for
future contributors.

-rob
Sign in to reply to this message.

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