<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/go-git.git/src/compress, branch dev.typeparams</title>
<subtitle>github.com: golang/go
</subtitle>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/go-git.git/'/>
<entry>
<title>compress/lzw: add Reset method to Reader and Writer</title>
<updated>2021-03-17T07:01:00+00:00</updated>
<author>
<name>Agniva De Sarker</name>
<email>agnivade@yahoo.co.in</email>
</author>
<published>2020-11-27T05:55:00+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/go-git.git/commit/?id=72b501cb0326f62a20621636942e5a95fc3c1466'/>
<id>72b501cb0326f62a20621636942e5a95fc3c1466</id>
<content type='text'>
We add a Reset method which clears any internal state of an encoder
or a decoder to let it be reused again as a new Writer or Reader respectively.

We also export the encoder and decoder structs, renaming them
to be Reader and Writer, and we guarantee that the underlying types
from the constructors will always be Reader and Writer respectively.

Benchmark results by reusing the encoder:
on cpu: Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz

name                 time/op
Decoder/1e4-8          93.6µs ± 1%
Decoder/1e-Reuse4-8    87.7µs ± 1%
Decoder/1e5-8           877µs ± 1%
Decoder/1e-Reuse5-8     860µs ± 3%
Decoder/1e6-8          8.79ms ± 1%
Decoder/1e-Reuse6-8    8.82ms ± 4%
Encoder/1e4-8           168µs ± 2%
Encoder/1e-Reuse4-8     160µs ± 1%
Encoder/1e5-8          1.64ms ± 1%
Encoder/1e-Reuse5-8    1.61ms ± 2%
Encoder/1e6-8          16.2ms ± 6%
Encoder/1e-Reuse6-8    15.8ms ± 2%

name                 speed
Decoder/1e4-8         107MB/s ± 1%
Decoder/1e-Reuse4-8   114MB/s ± 1%
Decoder/1e5-8         114MB/s ± 1%
Decoder/1e-Reuse5-8   116MB/s ± 3%
Decoder/1e6-8         114MB/s ± 1%
Decoder/1e-Reuse6-8   113MB/s ± 5%
Encoder/1e4-8        59.7MB/s ± 2%
Encoder/1e-Reuse4-8  62.4MB/s ± 1%
Encoder/1e5-8        61.1MB/s ± 1%
Encoder/1e-Reuse5-8  62.0MB/s ± 2%
Encoder/1e6-8        61.7MB/s ± 5%
Encoder/1e-Reuse6-8  63.4MB/s ± 2%

name                 alloc/op
Decoder/1e4-8          21.8kB ± 0%
Decoder/1e-Reuse4-8     50.0B ± 0%
Decoder/1e5-8          21.8kB ± 0%
Decoder/1e-Reuse5-8     70.4B ± 2%
Decoder/1e6-8          21.9kB ± 0%
Decoder/1e-Reuse6-8      271B ± 3%
Encoder/1e4-8          77.9kB ± 0%
Encoder/1e-Reuse4-8    4.17kB ± 0%
Encoder/1e5-8          77.9kB ± 0%
Encoder/1e-Reuse5-8    4.27kB ± 0%
Encoder/1e6-8          77.9kB ± 0%
Encoder/1e-Reuse6-8    5.22kB ± 0%

name                 allocs/op
Decoder/1e4-8            2.00 ± 0%
Decoder/1e-Reuse4-8      1.00 ± 0%
Decoder/1e5-8            2.00 ± 0%
Decoder/1e-Reuse5-8      1.00 ± 0%
Decoder/1e6-8            2.00 ± 0%
Decoder/1e-Reuse6-8      1.00 ± 0%
Encoder/1e4-8            3.00 ± 0%
Encoder/1e-Reuse4-8      2.00 ± 0%
Encoder/1e5-8            3.00 ± 0%
Encoder/1e-Reuse5-8      2.00 ± 0%
Encoder/1e6-8            3.00 ± 0%
Encoder/1e-Reuse6-8      2.00 ± 0%

Fixes #26535

Change-Id: Icde613fea6234a5bdce95f1e49910f5687e30b22
Reviewed-on: https://go-review.googlesource.com/c/go/+/273667
Trust: Agniva De Sarker &lt;agniva.quicksilver@gmail.com&gt;
Trust: Joe Tsai &lt;thebrokentoaster@gmail.com&gt;
Reviewed-by: Joe Tsai &lt;thebrokentoaster@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We add a Reset method which clears any internal state of an encoder
or a decoder to let it be reused again as a new Writer or Reader respectively.

We also export the encoder and decoder structs, renaming them
to be Reader and Writer, and we guarantee that the underlying types
from the constructors will always be Reader and Writer respectively.

Benchmark results by reusing the encoder:
on cpu: Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz

name                 time/op
Decoder/1e4-8          93.6µs ± 1%
Decoder/1e-Reuse4-8    87.7µs ± 1%
Decoder/1e5-8           877µs ± 1%
Decoder/1e-Reuse5-8     860µs ± 3%
Decoder/1e6-8          8.79ms ± 1%
Decoder/1e-Reuse6-8    8.82ms ± 4%
Encoder/1e4-8           168µs ± 2%
Encoder/1e-Reuse4-8     160µs ± 1%
Encoder/1e5-8          1.64ms ± 1%
Encoder/1e-Reuse5-8    1.61ms ± 2%
Encoder/1e6-8          16.2ms ± 6%
Encoder/1e-Reuse6-8    15.8ms ± 2%

name                 speed
Decoder/1e4-8         107MB/s ± 1%
Decoder/1e-Reuse4-8   114MB/s ± 1%
Decoder/1e5-8         114MB/s ± 1%
Decoder/1e-Reuse5-8   116MB/s ± 3%
Decoder/1e6-8         114MB/s ± 1%
Decoder/1e-Reuse6-8   113MB/s ± 5%
Encoder/1e4-8        59.7MB/s ± 2%
Encoder/1e-Reuse4-8  62.4MB/s ± 1%
Encoder/1e5-8        61.1MB/s ± 1%
Encoder/1e-Reuse5-8  62.0MB/s ± 2%
Encoder/1e6-8        61.7MB/s ± 5%
Encoder/1e-Reuse6-8  63.4MB/s ± 2%

name                 alloc/op
Decoder/1e4-8          21.8kB ± 0%
Decoder/1e-Reuse4-8     50.0B ± 0%
Decoder/1e5-8          21.8kB ± 0%
Decoder/1e-Reuse5-8     70.4B ± 2%
Decoder/1e6-8          21.9kB ± 0%
Decoder/1e-Reuse6-8      271B ± 3%
Encoder/1e4-8          77.9kB ± 0%
Encoder/1e-Reuse4-8    4.17kB ± 0%
Encoder/1e5-8          77.9kB ± 0%
Encoder/1e-Reuse5-8    4.27kB ± 0%
Encoder/1e6-8          77.9kB ± 0%
Encoder/1e-Reuse6-8    5.22kB ± 0%

name                 allocs/op
Decoder/1e4-8            2.00 ± 0%
Decoder/1e-Reuse4-8      1.00 ± 0%
Decoder/1e5-8            2.00 ± 0%
Decoder/1e-Reuse5-8      1.00 ± 0%
Decoder/1e6-8            2.00 ± 0%
Decoder/1e-Reuse6-8      1.00 ± 0%
Encoder/1e4-8            3.00 ± 0%
Encoder/1e-Reuse4-8      2.00 ± 0%
Encoder/1e5-8            3.00 ± 0%
Encoder/1e-Reuse5-8      2.00 ± 0%
Encoder/1e6-8            3.00 ± 0%
Encoder/1e-Reuse6-8      2.00 ± 0%

Fixes #26535

Change-Id: Icde613fea6234a5bdce95f1e49910f5687e30b22
Reviewed-on: https://go-review.googlesource.com/c/go/+/273667
Trust: Agniva De Sarker &lt;agniva.quicksilver@gmail.com&gt;
Trust: Joe Tsai &lt;thebrokentoaster@gmail.com&gt;
Reviewed-by: Joe Tsai &lt;thebrokentoaster@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>all: update to use os.ReadFile, os.WriteFile, os.CreateTemp, os.MkdirTemp</title>
<updated>2020-12-09T19:12:23+00:00</updated>
<author>
<name>Russ Cox</name>
<email>rsc@golang.org</email>
</author>
<published>2020-10-29T18:17:47+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/go-git.git/commit/?id=4f1b0a44cb46f3df28f5ef82e5769ebeac1bc493'/>
<id>4f1b0a44cb46f3df28f5ef82e5769ebeac1bc493</id>
<content type='text'>
As part of #42026, these helpers from io/ioutil were moved to os.
(ioutil.TempFile and TempDir became os.CreateTemp and MkdirTemp.)

Update the Go tree to use the preferred names.

As usual, code compiled with the Go 1.4 bootstrap toolchain
and code vendored from other sources is excluded.

ReadDir changes are in a separate CL, because they are not a
simple search and replace.

For #42026.

Change-Id: If318df0216d57e95ea0c4093b89f65e5b0ababb3
Reviewed-on: https://go-review.googlesource.com/c/go/+/266365
Trust: Russ Cox &lt;rsc@golang.org&gt;
Run-TryBot: Russ Cox &lt;rsc@golang.org&gt;
TryBot-Result: Go Bot &lt;gobot@golang.org&gt;
Reviewed-by: Ian Lance Taylor &lt;iant@golang.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
As part of #42026, these helpers from io/ioutil were moved to os.
(ioutil.TempFile and TempDir became os.CreateTemp and MkdirTemp.)

Update the Go tree to use the preferred names.

As usual, code compiled with the Go 1.4 bootstrap toolchain
and code vendored from other sources is excluded.

ReadDir changes are in a separate CL, because they are not a
simple search and replace.

For #42026.

Change-Id: If318df0216d57e95ea0c4093b89f65e5b0ababb3
Reviewed-on: https://go-review.googlesource.com/c/go/+/266365
Trust: Russ Cox &lt;rsc@golang.org&gt;
Run-TryBot: Russ Cox &lt;rsc@golang.org&gt;
TryBot-Result: Go Bot &lt;gobot@golang.org&gt;
Reviewed-by: Ian Lance Taylor &lt;iant@golang.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>all: update to use filepath.WalkDir instead of filepath.Walk</title>
<updated>2020-12-02T16:33:57+00:00</updated>
<author>
<name>Russ Cox</name>
<email>rsc@golang.org</email>
</author>
<published>2020-11-04T23:20:17+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/go-git.git/commit/?id=c32140fa94cfc51a2152855825f57e27ae3ba133'/>
<id>c32140fa94cfc51a2152855825f57e27ae3ba133</id>
<content type='text'>
Now that filepath.WalkDir is available, it is more efficient
and should be used in place of filepath.Walk.
Update the tree to reflect best practices.

As usual, the code compiled with Go 1.4 during bootstrap is excluded.
(In this CL, that's only cmd/dist.)

For #42027.

Change-Id: Ib0f7b1e43e50b789052f9835a63ced701d8c411c
Reviewed-on: https://go-review.googlesource.com/c/go/+/267719
Trust: Russ Cox &lt;rsc@golang.org&gt;
Run-TryBot: Russ Cox &lt;rsc@golang.org&gt;
TryBot-Result: Go Bot &lt;gobot@golang.org&gt;
Reviewed-by: Rob Pike &lt;r@golang.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Now that filepath.WalkDir is available, it is more efficient
and should be used in place of filepath.Walk.
Update the tree to reflect best practices.

As usual, the code compiled with Go 1.4 during bootstrap is excluded.
(In this CL, that's only cmd/dist.)

For #42027.

Change-Id: Ib0f7b1e43e50b789052f9835a63ced701d8c411c
Reviewed-on: https://go-review.googlesource.com/c/go/+/267719
Trust: Russ Cox &lt;rsc@golang.org&gt;
Run-TryBot: Russ Cox &lt;rsc@golang.org&gt;
TryBot-Result: Go Bot &lt;gobot@golang.org&gt;
Reviewed-by: Rob Pike &lt;r@golang.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>all: fix quoting for compress/bzip2 and time's godoc</title>
<updated>2020-10-23T21:57:39+00:00</updated>
<author>
<name>subham sarkar</name>
<email>sarkar.subhams2@gmail.com</email>
</author>
<published>2020-10-14T18:54:14+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/go-git.git/commit/?id=a972e8ccb9824d97f029bde5409527fb27e85989'/>
<id>a972e8ccb9824d97f029bde5409527fb27e85989</id>
<content type='text'>
The existing usage of grave accent (`) and apostrophe (')
at some places made godoc to ignore them and show it as it is.
So, use both of the characters twice (consecutively) so that
godoc can convert it to {left,right} double quotation mark.

Fixes #41958

Change-Id: I64fd9b5fa34f416ad595009d09f5482e10bd8b4f
Reviewed-on: https://go-review.googlesource.com/c/go/+/262397
Reviewed-by: Russ Cox &lt;rsc@golang.org&gt;
Trust: Alberto Donizetti &lt;alb.donizetti@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The existing usage of grave accent (`) and apostrophe (')
at some places made godoc to ignore them and show it as it is.
So, use both of the characters twice (consecutively) so that
godoc can convert it to {left,right} double quotation mark.

Fixes #41958

Change-Id: I64fd9b5fa34f416ad595009d09f5482e10bd8b4f
Reviewed-on: https://go-review.googlesource.com/c/go/+/262397
Reviewed-by: Russ Cox &lt;rsc@golang.org&gt;
Trust: Alberto Donizetti &lt;alb.donizetti@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>all: update references to symbols moved from io/ioutil to io</title>
<updated>2020-10-20T18:41:18+00:00</updated>
<author>
<name>Russ Cox</name>
<email>rsc@golang.org</email>
</author>
<published>2020-10-16T04:49:02+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/go-git.git/commit/?id=1b09d430678d4a6f73b2443463d11f75851aba8a'/>
<id>1b09d430678d4a6f73b2443463d11f75851aba8a</id>
<content type='text'>
The old ioutil references are still valid, but update our code
to reflect best practices and get used to the new locations.

Code compiled with the bootstrap toolchain
(cmd/asm, cmd/dist, cmd/compile, debug/elf)
must remain Go 1.4-compatible and is excluded.
Also excluded vendored code.

For #41190.

Change-Id: I6d86f2bf7bc37a9d904b6cee3fe0c7af6d94d5b1
Reviewed-on: https://go-review.googlesource.com/c/go/+/263142
Trust: Russ Cox &lt;rsc@golang.org&gt;
Run-TryBot: Russ Cox &lt;rsc@golang.org&gt;
TryBot-Result: Go Bot &lt;gobot@golang.org&gt;
Reviewed-by: Emmanuel Odeke &lt;emm.odeke@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The old ioutil references are still valid, but update our code
to reflect best practices and get used to the new locations.

Code compiled with the bootstrap toolchain
(cmd/asm, cmd/dist, cmd/compile, debug/elf)
must remain Go 1.4-compatible and is excluded.
Also excluded vendored code.

For #41190.

Change-Id: I6d86f2bf7bc37a9d904b6cee3fe0c7af6d94d5b1
Reviewed-on: https://go-review.googlesource.com/c/go/+/263142
Trust: Russ Cox &lt;rsc@golang.org&gt;
Run-TryBot: Russ Cox &lt;rsc@golang.org&gt;
TryBot-Result: Go Bot &lt;gobot@golang.org&gt;
Reviewed-by: Emmanuel Odeke &lt;emm.odeke@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>all: update references to symbols moved from os to io/fs</title>
<updated>2020-10-20T02:32:42+00:00</updated>
<author>
<name>Russ Cox</name>
<email>rsc@golang.org</email>
</author>
<published>2020-07-07T17:49:21+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/go-git.git/commit/?id=7bb721b9384bdd196befeaed593b185f7f2a5589'/>
<id>7bb721b9384bdd196befeaed593b185f7f2a5589</id>
<content type='text'>
The old os references are still valid, but update our code
to reflect best practices and get used to the new locations.

Code compiled with the bootstrap toolchain
(cmd/asm, cmd/dist, cmd/compile, debug/elf)
must remain Go 1.4-compatible and is excluded.

For #41190.

Change-Id: I8f9526977867c10a221e2f392f78d7dec073f1bd
Reviewed-on: https://go-review.googlesource.com/c/go/+/243907
Trust: Russ Cox &lt;rsc@golang.org&gt;
Run-TryBot: Russ Cox &lt;rsc@golang.org&gt;
TryBot-Result: Go Bot &lt;gobot@golang.org&gt;
Reviewed-by: Rob Pike &lt;r@golang.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The old os references are still valid, but update our code
to reflect best practices and get used to the new locations.

Code compiled with the bootstrap toolchain
(cmd/asm, cmd/dist, cmd/compile, debug/elf)
must remain Go 1.4-compatible and is excluded.

For #41190.

Change-Id: I8f9526977867c10a221e2f392f78d7dec073f1bd
Reviewed-on: https://go-review.googlesource.com/c/go/+/243907
Trust: Russ Cox &lt;rsc@golang.org&gt;
Run-TryBot: Russ Cox &lt;rsc@golang.org&gt;
TryBot-Result: Go Bot &lt;gobot@golang.org&gt;
Reviewed-by: Rob Pike &lt;r@golang.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>compress/flate: fix corrupted output</title>
<updated>2020-10-19T18:48:17+00:00</updated>
<author>
<name>Klaus Post</name>
<email>klauspost@gmail.com</email>
</author>
<published>2020-10-17T15:19:53+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/go-git.git/commit/?id=ab541a0560408999ac65d12bec2a3057994eda38'/>
<id>ab541a0560408999ac65d12bec2a3057994eda38</id>
<content type='text'>
The fastest compression mode can pick up a false match for every 2GB
of input data resulting in incorrectly decompressed data.

Since matches are allowed to be up to and including at maxMatchOffset
we must offset the buffer by an additional element to prevent the first
4 bytes to match after an out-of-reach value after shiftOffsets has
been called.

We offset by `maxMatchOffset + 1` so offset 0 in the table will now
fail the `if offset &gt; maxMatchOffset` in all cases.

Fixes #41420

Change-Id: If1fbe01728e132b8a207e3f3f439edd832dcc710
GitHub-Last-Rev: 50fabab0da874c37543b139459a810e12e83cee2
GitHub-Pull-Request: golang/go#41477
Reviewed-on: https://go-review.googlesource.com/c/go/+/255879
Reviewed-by: Matthew Dempsky &lt;mdempsky@google.com&gt;
Run-TryBot: Matthew Dempsky &lt;mdempsky@google.com&gt;
TryBot-Result: Go Bot &lt;gobot@golang.org&gt;
Trust: Joe Tsai &lt;thebrokentoaster@gmail.com&gt;
Trust: Matthew Dempsky &lt;mdempsky@google.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The fastest compression mode can pick up a false match for every 2GB
of input data resulting in incorrectly decompressed data.

Since matches are allowed to be up to and including at maxMatchOffset
we must offset the buffer by an additional element to prevent the first
4 bytes to match after an out-of-reach value after shiftOffsets has
been called.

We offset by `maxMatchOffset + 1` so offset 0 in the table will now
fail the `if offset &gt; maxMatchOffset` in all cases.

Fixes #41420

Change-Id: If1fbe01728e132b8a207e3f3f439edd832dcc710
GitHub-Last-Rev: 50fabab0da874c37543b139459a810e12e83cee2
GitHub-Pull-Request: golang/go#41477
Reviewed-on: https://go-review.googlesource.com/c/go/+/255879
Reviewed-by: Matthew Dempsky &lt;mdempsky@google.com&gt;
Run-TryBot: Matthew Dempsky &lt;mdempsky@google.com&gt;
TryBot-Result: Go Bot &lt;gobot@golang.org&gt;
Trust: Joe Tsai &lt;thebrokentoaster@gmail.com&gt;
Trust: Matthew Dempsky &lt;mdempsky@google.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>compress/flate: revert a goto for-loop</title>
<updated>2020-10-16T14:23:21+00:00</updated>
<author>
<name>Daniel Martí</name>
<email>mvdan@mvdan.cc</email>
</author>
<published>2020-10-16T14:05:04+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/go-git.git/commit/?id=771f5f2e487db4eb2bcf6fa1660dc8cef1feaf14'/>
<id>771f5f2e487db4eb2bcf6fa1660dc8cef1feaf14</id>
<content type='text'>
In https://golang.org/cl/16528, a goto loop was chosen over a regular
for loop since that would make the function inlinable.

Thanks to the recent https://golang.org/cl/256459, for loops without a
label can now be inlined. So we can undo the workaround and simplify the
code.

Also add the function to TestIntendedInlining, which passes both before
and after the change, as expected.

For #14768.

Change-Id: Ie5df55a6bcb07c538ca331eef2f908807ff0b516
Reviewed-on: https://go-review.googlesource.com/c/go/+/263037
Trust: Daniel Martí &lt;mvdan@mvdan.cc&gt;
Run-TryBot: Daniel Martí &lt;mvdan@mvdan.cc&gt;
Reviewed-by: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
TryBot-Result: Go Bot &lt;gobot@golang.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In https://golang.org/cl/16528, a goto loop was chosen over a regular
for loop since that would make the function inlinable.

Thanks to the recent https://golang.org/cl/256459, for loops without a
label can now be inlined. So we can undo the workaround and simplify the
code.

Also add the function to TestIntendedInlining, which passes both before
and after the change, as expected.

For #14768.

Change-Id: Ie5df55a6bcb07c538ca331eef2f908807ff0b516
Reviewed-on: https://go-review.googlesource.com/c/go/+/263037
Trust: Daniel Martí &lt;mvdan@mvdan.cc&gt;
Run-TryBot: Daniel Martí &lt;mvdan@mvdan.cc&gt;
Reviewed-by: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
TryBot-Result: Go Bot &lt;gobot@golang.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>compress/flate: remove unneeded zeroing of bytes array in (*huffmanBitWriter).reset</title>
<updated>2020-10-06T20:30:36+00:00</updated>
<author>
<name>Dan Scales</name>
<email>danscales@google.com</email>
</author>
<published>2020-09-30T23:34:47+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/go-git.git/commit/?id=04c7e32517faf6257986e7c4cdd3f5f03eeae37b'/>
<id>04c7e32517faf6257986e7c4cdd3f5f03eeae37b</id>
<content type='text'>
There is no correctness reason to zero out the w.bytes array in (w
*huffmanBitWriter).reset, since w.nbytes is correctly set to zero. The elements of
the bytes array are always written sequentially, with nbytes indicating how many
elements have been written, and are only read up to the current value of nybytes.

We have a pprof profile of a web server that compresses its request/responses, and
the zeroing in reset() is taking up 2.6% of the CPU time of the server (and could
be causing more slowdowns elsewhere due to its effects on the cache). This
overhead may be showing up especially because there are many request/responses
that are all fairly small.

I'm not sure if the zeroing of the bytes array was intended as extra protection of
data across reset uses in the same program, but no protection is needed as long as
the huffman_bit_writer code remains correct.

Change-Id: I67f2b2f56cff9dcc38d8fc0aea885bb010aeedbf
Reviewed-on: https://go-review.googlesource.com/c/go/+/258577
Run-TryBot: Dan Scales &lt;danscales@google.com&gt;
Run-TryBot: Joe Tsai &lt;joetsai@google.com&gt;
TryBot-Result: Go Bot &lt;gobot@golang.org&gt;
Reviewed-by: Klaus Post &lt;klauspost@gmail.com&gt;
Reviewed-by: Joe Tsai &lt;joetsai@google.com&gt;
Trust: Joe Tsai &lt;joetsai@google.com&gt;
Trust: Dan Scales &lt;danscales@google.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
There is no correctness reason to zero out the w.bytes array in (w
*huffmanBitWriter).reset, since w.nbytes is correctly set to zero. The elements of
the bytes array are always written sequentially, with nbytes indicating how many
elements have been written, and are only read up to the current value of nybytes.

We have a pprof profile of a web server that compresses its request/responses, and
the zeroing in reset() is taking up 2.6% of the CPU time of the server (and could
be causing more slowdowns elsewhere due to its effects on the cache). This
overhead may be showing up especially because there are many request/responses
that are all fairly small.

I'm not sure if the zeroing of the bytes array was intended as extra protection of
data across reset uses in the same program, but no protection is needed as long as
the huffman_bit_writer code remains correct.

Change-Id: I67f2b2f56cff9dcc38d8fc0aea885bb010aeedbf
Reviewed-on: https://go-review.googlesource.com/c/go/+/258577
Run-TryBot: Dan Scales &lt;danscales@google.com&gt;
Run-TryBot: Joe Tsai &lt;joetsai@google.com&gt;
TryBot-Result: Go Bot &lt;gobot@golang.org&gt;
Reviewed-by: Klaus Post &lt;klauspost@gmail.com&gt;
Reviewed-by: Joe Tsai &lt;joetsai@google.com&gt;
Trust: Joe Tsai &lt;joetsai@google.com&gt;
Trust: Dan Scales &lt;danscales@google.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>compress/flate: fix another deflate Reset inconsistency</title>
<updated>2020-07-16T23:38:32+00:00</updated>
<author>
<name>Russ Cox</name>
<email>rsc@golang.org</email>
</author>
<published>2020-07-16T20:56:53+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/go-git.git/commit/?id=4469f5446ad754d87afb340f59c213aec2dc4fb8'/>
<id>4469f5446ad754d87afb340f59c213aec2dc4fb8</id>
<content type='text'>
While investigating #34121, fixed by CL 193605,
I discovered another case where Reset was not quite
resetting enough.

This specific case is not a problem in Reset itself but
rather that the Huffman bit writer in one code path
is using uninitialized memory left over from a previous
block, making the compression not choose the optimal
compression method.

Fixes #34121.

Change-Id: I29245b28214d924e382f91e2c56b4b8a9b7da13d
Reviewed-on: https://go-review.googlesource.com/c/go/+/243140
Run-TryBot: Russ Cox &lt;rsc@golang.org&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
Reviewed-by: Joe Tsai &lt;thebrokentoaster@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
While investigating #34121, fixed by CL 193605,
I discovered another case where Reset was not quite
resetting enough.

This specific case is not a problem in Reset itself but
rather that the Huffman bit writer in one code path
is using uninitialized memory left over from a previous
block, making the compression not choose the optimal
compression method.

Fixes #34121.

Change-Id: I29245b28214d924e382f91e2c56b4b8a9b7da13d
Reviewed-on: https://go-review.googlesource.com/c/go/+/243140
Run-TryBot: Russ Cox &lt;rsc@golang.org&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
Reviewed-by: Joe Tsai &lt;thebrokentoaster@gmail.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
