summaryrefslogtreecommitdiff
path: root/src/encoding/gob/enc_helpers.go
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2014-10-17 12:37:41 -0700
committerRob Pike <r@golang.org>2014-10-17 12:37:41 -0700
commit4ad114508dcf5edeb4ea530ec3db2b0ecd8d4f89 (patch)
tree381cb227abc995d5d6019eb016eb3c8fce2abcaa /src/encoding/gob/enc_helpers.go
parent800774510e3b6044f34fe95dbf24c1319bbbafed (diff)
downloadgo-4ad114508dcf5edeb4ea530ec3db2b0ecd8d4f89.tar.gz
encoding/gob: custom array/slice decoders
Use go generate to write better loops for decoding arrays, just as we did for encoding. It doesn't help as much, relatively speaking, but it's still noticeable. benchmark old ns/op new ns/op delta BenchmarkDecodeComplex128Slice 202348 184529 -8.81% BenchmarkDecodeFloat64Slice 135800 120979 -10.91% BenchmarkDecodeInt32Slice 121200 105149 -13.24% BenchmarkDecodeStringSlice 288129 278214 -3.44% LGTM=rsc R=rsc CC=golang-codereviews https://codereview.appspot.com/154420044
Diffstat (limited to 'src/encoding/gob/enc_helpers.go')
-rw-r--r--src/encoding/gob/enc_helpers.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/encoding/gob/enc_helpers.go b/src/encoding/gob/enc_helpers.go
index 1e6f30718..804e539d8 100644
--- a/src/encoding/gob/enc_helpers.go
+++ b/src/encoding/gob/enc_helpers.go
@@ -10,7 +10,7 @@ import (
"reflect"
)
-var arrayHelper = map[reflect.Kind]encHelper{
+var encArrayHelper = map[reflect.Kind]encHelper{
reflect.Bool: encBoolArray,
reflect.Complex64: encComplex64Array,
reflect.Complex128: encComplex128Array,
@@ -29,7 +29,7 @@ var arrayHelper = map[reflect.Kind]encHelper{
reflect.Uintptr: encUintptrArray,
}
-var sliceHelper = map[reflect.Kind]encHelper{
+var encSliceHelper = map[reflect.Kind]encHelper{
reflect.Bool: encBoolSlice,
reflect.Complex64: encComplex64Slice,
reflect.Complex128: encComplex128Slice,