<feed xmlns='http://www.w3.org/2005/Atom'>
<title>go/src/encoding/binary/binary.go, branch go1.15.2</title>
<subtitle>Fork of Go programming language with my patches.</subtitle>
<id>http://git.kilabit.info/go/atom?h=go1.15.2</id>
<link rel='self' href='http://git.kilabit.info/go/atom?h=go1.15.2'/>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/'/>
<updated>2019-11-08T18:35:59Z</updated>
<entry>
<title>encoding/binary: add float support to fast path</title>
<updated>2019-11-08T18:35:59Z</updated>
<author>
<name>Martin Garton</name>
<email>garton@gmail.com</email>
</author>
<published>2019-09-30T09:27:38Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=7714dcacbca1961543fbad0c8bc2a2afc7baaaee'/>
<id>urn:sha1:7714dcacbca1961543fbad0c8bc2a2afc7baaaee</id>
<content type='text'>
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 &lt;bradfitz@golang.org&gt;
</content>
</entry>
<entry>
<title>encoding/binary: make Read return an error when data is not a pointer</title>
<updated>2019-11-08T18:00:31Z</updated>
<author>
<name>Udalov Max</name>
<email>re.udalov@gmail.com</email>
</author>
<published>2019-07-03T20:31:50Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=c444ec308506463bd4ab3226c6aab55746347780'/>
<id>urn:sha1:c444ec308506463bd4ab3226c6aab55746347780</id>
<content type='text'>
Make binary.Read return an error when passed `data` argument is not
a pointer to a fixed-size value or a slice of fixed-size values.

Fixes #32927

Change-Id: I04f48be55fe9b0cc66c983d152407d0e42cbcd95
Reviewed-on: https://go-review.googlesource.com/c/go/+/184957
Reviewed-by: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
</content>
</entry>
<entry>
<title>encoding/binary: cache struct sizes to speed up Read and Write</title>
<updated>2019-11-01T20:16:01Z</updated>
<author>
<name>Lorenz Bauer</name>
<email>lmb@cloudflare.com</email>
</author>
<published>2019-11-01T10:39:35Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=c9d89f6bacd66d4765cf36d2a4b121392921c5ed'/>
<id>urn:sha1:c9d89f6bacd66d4765cf36d2a4b121392921c5ed</id>
<content type='text'>
A majority of work is spent in dataSize when en/decoding the same
struct over and over again. This wastes a lot of work, since
the result doesn't change for a given reflect.Value.

Cache the result of the function for structs, so that subsequent
calls to dataSize can avoid doing work.

    name         old time/op    new time/op     delta
    ReadStruct     1.00µs ± 1%     0.37µs ± 1%   -62.99%  (p=0.029 n=4+4)
    WriteStruct    1.00µs ± 3%     0.37µs ± 1%   -62.69%  (p=0.008 n=5+5)

    name         old speed      new speed       delta
    ReadStruct   75.1MB/s ± 1%  202.9MB/s ± 1%  +170.16%  (p=0.029 n=4+4)
    WriteStruct  74.8MB/s ± 3%  200.4MB/s ± 1%  +167.96%  (p=0.008 n=5+5)

Fixes #34471

Change-Id: Ic5d987ca95f1197415ef93643a0af6fc1224fdf0
Reviewed-on: https://go-review.googlesource.com/c/go/+/199539
Reviewed-by: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
Run-TryBot: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
</content>
</entry>
<entry>
<title>encoding/binary: simplify Read and Write</title>
<updated>2018-09-04T14:52:30Z</updated>
<author>
<name>Josh Bleecher Snyder</name>
<email>josharian@gmail.com</email>
</author>
<published>2018-09-01T17:43:22Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=2179e495cec167f42ff7d0007668d9c09ce15958'/>
<id>urn:sha1:2179e495cec167f42ff7d0007668d9c09ce15958</id>
<content type='text'>
There's no need to manually manage the backing slice for bs.
Removing it simplifies the code, removes some allocations,
and speeds it up slightly.

Fixes #27403

name                     old time/op    new time/op    delta
ReadSlice1000Int32s-8      6.39µs ± 1%    6.31µs ± 1%   -1.37%  (p=0.000 n=27+27)
ReadStruct-8               1.25µs ± 2%    1.23µs ± 2%   -1.06%  (p=0.003 n=30+29)
ReadInts-8                  301ns ± 0%     297ns ± 1%   -1.21%  (p=0.000 n=27+30)
WriteInts-8                 325ns ± 1%     320ns ± 1%   -1.59%  (p=0.000 n=26+29)
WriteSlice1000Int32s-8     6.60µs ± 0%    6.52µs ± 0%   -1.23%  (p=0.000 n=28+27)
PutUint16-8                0.72ns ± 2%    0.71ns ± 2%     ~     (p=0.286 n=30+30)
PutUint32-8                0.71ns ± 1%    0.71ns ± 0%   -0.42%  (p=0.003 n=30+25)
PutUint64-8                0.78ns ± 2%    0.78ns ± 0%   -0.55%  (p=0.001 n=30+27)
LittleEndianPutUint16-8    0.57ns ± 0%    0.57ns ± 0%     ~     (all equal)
LittleEndianPutUint32-8    0.57ns ± 0%    0.57ns ± 0%     ~     (all equal)
LittleEndianPutUint64-8    0.57ns ± 0%    0.57ns ± 0%     ~     (all equal)
PutUvarint32-8             23.1ns ± 1%    23.1ns ± 1%     ~     (p=0.925 n=26+29)
PutUvarint64-8             57.5ns ± 2%    57.3ns ± 1%     ~     (p=0.338 n=30+26)
[Geo mean]                 23.0ns         22.9ns        -0.61%

name                     old speed      new speed      delta
ReadSlice1000Int32s-8     626MB/s ± 1%   634MB/s ± 1%   +1.38%  (p=0.000 n=27+27)
ReadStruct-8             60.2MB/s ± 2%  60.8MB/s ± 2%   +1.08%  (p=0.002 n=30+29)
ReadInts-8                100MB/s ± 1%   101MB/s ± 1%   +1.24%  (p=0.000 n=27+30)
WriteInts-8              92.2MB/s ± 1%  93.6MB/s ± 1%   +1.56%  (p=0.000 n=26+29)
WriteSlice1000Int32s-8    606MB/s ± 0%   614MB/s ± 0%   +1.24%  (p=0.000 n=28+27)
PutUint16-8              2.80GB/s ± 1%  2.80GB/s ± 1%     ~     (p=0.095 n=28+29)
PutUint32-8              5.61GB/s ± 1%  5.62GB/s ± 1%     ~     (p=0.069 n=27+28)
PutUint64-8              10.2GB/s ± 1%  10.2GB/s ± 0%   +0.15%  (p=0.039 n=27+27)
LittleEndianPutUint16-8  3.50GB/s ± 1%  3.50GB/s ± 1%     ~     (p=0.552 n=30+29)
LittleEndianPutUint32-8  7.01GB/s ± 1%  7.02GB/s ± 1%     ~     (p=0.160 n=29+27)
LittleEndianPutUint64-8  14.0GB/s ± 1%  14.0GB/s ± 1%     ~     (p=0.413 n=29+29)
PutUvarint32-8            174MB/s ± 1%   173MB/s ± 1%     ~     (p=0.648 n=25+30)
PutUvarint64-8            139MB/s ± 2%   140MB/s ± 1%     ~     (p=0.271 n=30+26)
[Geo mean]                906MB/s        911MB/s        +0.55%

name                     old alloc/op   new alloc/op   delta
ReadSlice1000Int32s-8      4.14kB ± 0%    4.13kB ± 0%   -0.19%  (p=0.000 n=30+30)
ReadStruct-8                 200B ± 0%      200B ± 0%     ~     (all equal)
ReadInts-8                  64.0B ± 0%     32.0B ± 0%  -50.00%  (p=0.000 n=30+30)
WriteInts-8                  112B ± 0%       64B ± 0%  -42.86%  (p=0.000 n=30+30)
WriteSlice1000Int32s-8     4.14kB ± 0%    4.13kB ± 0%   -0.19%  (p=0.000 n=30+30)
PutUint16-8                 0.00B          0.00B          ~     (all equal)
PutUint32-8                 0.00B          0.00B          ~     (all equal)
PutUint64-8                 0.00B          0.00B          ~     (all equal)
LittleEndianPutUint16-8     0.00B          0.00B          ~     (all equal)
LittleEndianPutUint32-8     0.00B          0.00B          ~     (all equal)
LittleEndianPutUint64-8     0.00B          0.00B          ~     (all equal)
PutUvarint32-8              0.00B          0.00B          ~     (all equal)
PutUvarint64-8              0.00B          0.00B          ~     (all equal)
[Geo mean]                   476B           370B       -22.22%

name                     old allocs/op  new allocs/op  delta
ReadSlice1000Int32s-8        3.00 ± 0%      2.00 ± 0%  -33.33%  (p=0.000 n=30+30)
ReadStruct-8                 16.0 ± 0%      16.0 ± 0%     ~     (all equal)
ReadInts-8                   8.00 ± 0%      8.00 ± 0%     ~     (all equal)
WriteInts-8                  14.0 ± 0%      14.0 ± 0%     ~     (all equal)
WriteSlice1000Int32s-8       3.00 ± 0%      2.00 ± 0%  -33.33%  (p=0.000 n=30+30)
PutUint16-8                  0.00           0.00          ~     (all equal)
PutUint32-8                  0.00           0.00          ~     (all equal)
PutUint64-8                  0.00           0.00          ~     (all equal)
LittleEndianPutUint16-8      0.00           0.00          ~     (all equal)
LittleEndianPutUint32-8      0.00           0.00          ~     (all equal)
LittleEndianPutUint64-8      0.00           0.00          ~     (all equal)
PutUvarint32-8               0.00           0.00          ~     (all equal)
PutUvarint64-8               0.00           0.00          ~     (all equal)
[Geo mean]                   6.94           5.90       -14.97%

Change-Id: I3790b93e4190d98621d5f2c47e42929a18f56c2e
Reviewed-on: https://go-review.googlesource.com/133135
Run-TryBot: Josh Bleecher Snyder &lt;josharian@gmail.com&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
Reviewed-by: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
</content>
</entry>
<entry>
<title>encoding/binary: returns length of bool slice in intDataSize</title>
<updated>2018-05-08T14:48:50Z</updated>
<author>
<name>Joe Kyo</name>
<email>xunianzu@gmail.com</email>
</author>
<published>2018-05-08T13:00:36Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=5188b4dea0614a15caa729d3c3153e1128e55f80'/>
<id>urn:sha1:5188b4dea0614a15caa729d3c3153e1128e55f80</id>
<content type='text'>
intDataSize should return length of bool slice, so functions
Read and Write can use the fast path to process bool slice.

Change-Id: I8cd275e3ffea82024850662d86caca64bd91bf70
Reviewed-on: https://go-review.googlesource.com/112135
Reviewed-by: Ian Lance Taylor &lt;iant@golang.org&gt;
Run-TryBot: Ian Lance Taylor &lt;iant@golang.org&gt;
</content>
</entry>
<entry>
<title>encoding/binary: use an offset instead of slicing</title>
<updated>2018-03-06T18:59:03Z</updated>
<author>
<name>Josh Bleecher Snyder</name>
<email>josharian@gmail.com</email>
</author>
<published>2018-03-05T15:40:14Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=b85433975aedc2be2971093b6bbb0a7dc264c8fd'/>
<id>urn:sha1:b85433975aedc2be2971093b6bbb0a7dc264c8fd</id>
<content type='text'>
While running make.bash, over 5% of all pointer writes
come from encoding/binary doing struct reads.

This change replaces slicing during such reads with an offset.
This avoids updating the slice pointer with every
struct field read or write.

This has no impact when the write barrier is off.
Running the benchmarks with GOGC=1, however,
shows significant improvement:

name          old time/op    new time/op    delta
ReadStruct-8    13.2µs ± 6%    10.1µs ± 5%  -23.24%  (p=0.000 n=10+10)

name          old speed      new speed      delta
ReadStruct-8  5.69MB/s ± 6%  7.40MB/s ± 5%  +30.18%  (p=0.000 n=10+10)

Change-Id: I22904263196bfeddc38abe8989428e263aee5253
Reviewed-on: https://go-review.googlesource.com/98757
Run-TryBot: Josh Bleecher Snyder &lt;josharian@gmail.com&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
Reviewed-by: Ian Lance Taylor &lt;iant@golang.org&gt;
</content>
</entry>
<entry>
<title>encoding/binary: clarify the repercussions for not following the docs</title>
<updated>2017-06-29T03:29:11Z</updated>
<author>
<name>Brad Fitzpatrick</name>
<email>bradfitz@golang.org</email>
</author>
<published>2017-06-28T23:12:41Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=f081266e4af4bdce22756aa58489225dfbe6bb23'/>
<id>urn:sha1:f081266e4af4bdce22756aa58489225dfbe6bb23</id>
<content type='text'>
Fixes #19794

Change-Id: I462cbc432fe9d4a9e6e79a9833b0013d82a0780e
Reviewed-on: https://go-review.googlesource.com/47093
Reviewed-by: Ian Lance Taylor &lt;iant@golang.org&gt;
</content>
</entry>
<entry>
<title>encoding/binary: document the new bool support</title>
<updated>2016-12-01T00:51:24Z</updated>
<author>
<name>Brad Fitzpatrick</name>
<email>bradfitz@golang.org</email>
</author>
<published>2016-12-01T00:48:51Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=b43384e8717c86d9d5051b6bc02047ce5ec2701f'/>
<id>urn:sha1:b43384e8717c86d9d5051b6bc02047ce5ec2701f</id>
<content type='text'>
Updates #16856

Change-Id: I57af6b0c0d5ecdaf19cf6f969b05ec9ec03058f1
Reviewed-on: https://go-review.googlesource.com/33756
Reviewed-by: Ian Lance Taylor &lt;iant@golang.org&gt;
</content>
</entry>
<entry>
<title>encoding/binary: add bool support</title>
<updated>2016-09-28T16:20:41Z</updated>
<author>
<name>Blixt</name>
<email>me@blixt.nyc</email>
</author>
<published>2016-08-24T16:59:01Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=456a01ac47c1473d6b241c56eb8db0cb832d9be2'/>
<id>urn:sha1:456a01ac47c1473d6b241c56eb8db0cb832d9be2</id>
<content type='text'>
This change adds support for decoding and encoding the bool type. The
encoding is a single byte, with a zero value for false and a non-zero
value for true.

Closes #16856.

Change-Id: I1d1114b320263691473bb100cad0f380e0204186
Reviewed-on: https://go-review.googlesource.com/28514
Reviewed-by: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
Run-TryBot: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
</content>
</entry>
<entry>
<title>all: remove unnecessary type conversions</title>
<updated>2016-04-15T07:31:45Z</updated>
<author>
<name>Matthew Dempsky</name>
<email>mdempsky@google.com</email>
</author>
<published>2016-04-15T02:09:36Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=0da4dbe2322eb3b6224df35ce3e9fc83f104762b'/>
<id>urn:sha1:0da4dbe2322eb3b6224df35ce3e9fc83f104762b</id>
<content type='text'>
cmd and runtime were handled separately, and I'm intentionally skipped
syscall. This is the rest of the standard library.

CL generated mechanically with github.com/mdempsky/unconvert.

Change-Id: I9e0eff886974dedc37adb93f602064b83e469122
Reviewed-on: https://go-review.googlesource.com/22104
Reviewed-by: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
Run-TryBot: Matthew Dempsky &lt;mdempsky@google.com&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
</content>
</entry>
</feed>
