]> Cypherpunks repositories - gostls13.git/commit
encoding/binary: speed up writing slices of integers
authorRob Pike <r@golang.org>
Fri, 9 Aug 2013 13:15:08 +0000 (23:15 +1000)
committerRob Pike <r@golang.org>
Fri, 9 Aug 2013 13:15:08 +0000 (23:15 +1000)
commitc0465d0326c01f4f03f77cf3821d8b0f632364c1
treed938d1dac222931adc44e88e09a2c7af776f5497
parentb0a1b82ec133d08505d69a064b0dac0d807817e2
encoding/binary: speed up writing slices of integers

Simple approach. Still generates garbage, but not as much.

benchmark                        old ns/op    new ns/op    delta
BenchmarkWriteSlice1000Int32s        40260        18791  -53.33%

benchmark                         old MB/s     new MB/s  speedup
BenchmarkWriteSlice1000Int32s        99.35       212.87    2.14x

Fixes #2634.

R=golang-dev, crawshaw
CC=golang-dev
https://golang.org/cl/12680046
src/pkg/encoding/binary/binary.go
src/pkg/encoding/binary/binary_test.go