golang/src/encoding/binary
Lorenz Bauer ec1724bc99 encoding/binary: simplify encoder.value
Remove some duplicate type switching from encoder.value. reflect.Uint and
reflect.Int don't have a case statement anymore, but since they aren't valid
types there is no change in semantics.

goos: darwin
goarch: arm64
pkg: encoding/binary
cpu: Apple M1 Pro
                            │   base.txt   │            simplify.txt             │
                            │    sec/op    │    sec/op     vs base               │
ReadSlice1000Int32s-10         2.649µ ± 1%    2.645µ ± 0%        ~ (p=0.069 n=6)
ReadStruct-10                  204.8n ± 2%    199.9n ± 0%   -2.39% (p=0.002 n=6)
WriteStruct-10                 185.6n ± 2%    154.0n ± 0%  -17.03% (p=0.002 n=6)
WriteSlice1000Structs-10       157.9µ ± 1%    125.0µ ± 0%  -20.86% (p=0.002 n=6)
ReadSlice1000Structs-10        162.6µ ± 2%    159.3µ ± 0%        ~ (p=0.065 n=6)
ReadInts-10                    159.7n ± 1%    156.7n ± 0%   -1.88% (p=0.002 n=6)
WriteInts-10                   134.2n ± 0%    134.1n ± 0%   -0.11% (p=0.011 n=6)
WriteSlice1000Int32s-10        2.680µ ± 0%    2.680µ ± 0%        ~ (p=0.955 n=6)
PutUint16-10                  0.6253n ± 2%   0.6211n ± 0%   -0.67% (p=0.013 n=6)
AppendUint16-10                1.417n ± 2%    1.413n ± 0%        ~ (p=0.065 n=6)
PutUint32-10                  0.6210n ± 0%   0.6210n ± 0%        ~ (p=0.835 n=6)
AppendUint32-10                1.414n ± 0%    1.414n ± 0%        ~ (p=1.000 n=6)
PutUint64-10                  0.6210n ± 0%   0.6212n ± 0%        ~ (p=0.260 n=6)
AppendUint64-10                1.414n ± 1%    1.417n ± 0%        ~ (p=0.097 n=6)
LittleEndianPutUint16-10      0.6236n ± 0%   0.6238n ± 0%        ~ (p=0.426 n=6)
LittleEndianAppendUint16-10    1.419n ± 0%    1.421n ± 1%        ~ (p=0.054 n=6)
LittleEndianPutUint32-10      0.6236n ± 0%   0.6239n ± 0%        ~ (p=0.457 n=6)
LittleEndianAppendUint32-10    1.421n ± 3%    1.421n ± 0%        ~ (p=1.000 n=6)
LittleEndianPutUint64-10      0.6242n ± 1%   0.6239n ± 0%        ~ (p=0.372 n=6)
LittleEndianAppendUint64-10    1.421n ± 0%    1.421n ± 0%        ~ (p=1.000 n=6)
ReadFloats-10                  39.39n ± 0%    39.35n ± 0%   -0.10% (p=0.026 n=6)
WriteFloats-10                 33.64n ± 0%    33.65n ± 0%        ~ (p=0.297 n=6)
ReadSlice1000Float32s-10       2.661µ ± 0%    2.664µ ± 0%        ~ (p=0.916 n=6)
WriteSlice1000Float32s-10      2.763µ ± 0%    2.758µ ± 2%        ~ (p=0.225 n=6)
ReadSlice1000Uint8s-10         129.5n ± 2%    129.5n ± 2%        ~ (p=0.485 n=6)
WriteSlice1000Uint8s-10        144.4n ± 4%    146.1n ± 2%        ~ (p=0.065 n=6)
PutUvarint32-10                12.12n ± 0%    12.12n ± 2%        ~ (p=0.933 n=6)
PutUvarint64-10                30.75n ± 0%    31.29n ± 1%   +1.76% (p=0.002 n=6)
geomean                        33.44n         32.89n        -1.65%

Change-Id: Ibce978012c268a7f26fe7567c340c861fa4b115d
Reviewed-on: https://go-review.googlesource.com/c/go/+/579156
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-13 21:22:39 +00:00
..
binary.go encoding/binary: simplify encoder.value 2024-05-13 21:22:39 +00:00
binary_test.go encoding/binary: cache struct sizes to speed up Read and Write for slice of structs. 2024-03-13 18:32:53 +00:00
example_test.go all: gofmt -w -r 'interface{} -> any' src 2021-12-13 18:45:54 +00:00
native_endian_big.go encoding: modernize Go documentation 2023-09-08 19:04:28 +00:00
native_endian_little.go encoding: modernize Go documentation 2023-09-08 19:04:28 +00:00
varint.go encoding: modernize Go documentation 2023-09-08 19:04:28 +00:00
varint_test.go src: rename unexported errors by adding prefix err 2023-02-16 23:09:19 +00:00