]> Cypherpunks repositories - gostls13.git/commit
encoding/binary: add float support to fast path
authorMartin Garton <garton@gmail.com>
Mon, 30 Sep 2019 09:27:38 +0000 (09:27 +0000)
committerBrad Fitzpatrick <bradfitz@golang.org>
Fri, 8 Nov 2019 18:35:59 +0000 (18:35 +0000)
commit7714dcacbca1961543fbad0c8bc2a2afc7baaaee
tree316f21c0286199ec5b556081360b869828238daf
parent3e5c04313c28e463fa866c2ef669ed66628faf9b
encoding/binary: add float support to fast path

This adds float type support to the main switch blocks in Read and
Write, instead of falling back to reflection. This gives a considerable
speedup for the float types:

ReadFloats-8                 129ns ± 9%       70ns ± 8%   -46.02%  (p=0.001 n=7+7)
WriteFloats-8                131ns ± 6%       86ns ±11%   -34.59%  (p=0.001 n=7+7)
ReadSlice1000Float32s-8     14.6µs ±14%      4.8µs ±12%   -67.29%  (p=0.001 n=7+7)
WriteSlice1000Float32s-8    16.4µs ±20%      4.7µs ± 8%   -71.01%  (p=0.001 n=7+7)

Change-Id: I0be99d068b07d10dd6eb1137b45eff6f7c216b87
GitHub-Last-Rev: 4ff326e99ca35977d819f0ba29c10d9efc7e811c
GitHub-Pull-Request: golang/go#31803
Reviewed-on: https://go-review.googlesource.com/c/go/+/174959
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/encoding/binary/binary.go
src/encoding/binary/binary_test.go