<feed xmlns='http://www.w3.org/2005/Atom'>
<title>go/src/bytes/buffer_test.go, branch fix-runtime-test-GOMAXPROCS</title>
<subtitle>Fork of Go programming language with my patches.</subtitle>
<id>http://git.kilabit.info/go/atom?h=fix-runtime-test-GOMAXPROCS</id>
<link rel='self' href='http://git.kilabit.info/go/atom?h=fix-runtime-test-GOMAXPROCS'/>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/'/>
<updated>2025-05-19T16:13:04Z</updated>
<entry>
<title>std: pass bytes.Buffer and strings.Builder by pointer</title>
<updated>2025-05-19T16:13:04Z</updated>
<author>
<name>Alan Donovan</name>
<email>adonovan@google.com</email>
</author>
<published>2024-12-11T20:42:06Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=198c3cb785282ee4c199680ec2d05381805a6f66'/>
<id>urn:sha1:198c3cb785282ee4c199680ec2d05381805a6f66</id>
<content type='text'>
This CL fixes a number of (all true positive) findings of vet's
copylock analyzer patched to treat the Bu{ff,uild}er types
as non-copyable after first use.

This does require imposing an additional indirection
between noder.writer and Encoder since the field is
embedded by value but its constructor now returns a pointer.

Updates golang/go#25907
Updates golang/go#47276

Change-Id: I0b4d77ac12bcecadf06a91709e695365da10766c
Reviewed-on: https://go-review.googlesource.com/c/go/+/635339
Reviewed-by: Robert Findley &lt;rfindley@google.com&gt;
Commit-Queue: Alan Donovan &lt;adonovan@google.com&gt;
LUCI-TryBot-Result: Go LUCI &lt;golang-scoped@luci-project-accounts.iam.gserviceaccount.com&gt;
Auto-Submit: Alan Donovan &lt;adonovan@google.com&gt;
</content>
</entry>
<entry>
<title>all: omit unnecessary 0 in slice expression</title>
<updated>2024-09-03T20:55:15Z</updated>
<author>
<name>nlwkobe30</name>
<email>nlwkobe30@gmail.com</email>
</author>
<published>2024-08-30T19:05:07Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=7cd0a4be5cdbb84142ec330daba6087eece48341'/>
<id>urn:sha1:7cd0a4be5cdbb84142ec330daba6087eece48341</id>
<content type='text'>
All changes are related to the code, except for the comments in src/regexp/syntax/parse.go and src/slices/slices.go.

Change-Id: I73c5d3c54099749b62210aa7f3182c5eb84bb6a6
GitHub-Last-Rev: 794aa9b0539811d00e1cd42be1e8d9fe9afe0281
GitHub-Pull-Request: golang/go#69170
Reviewed-on: https://go-review.googlesource.com/c/go/+/609678
Reviewed-by: Dmitri Shuralyov &lt;dmitshur@google.com&gt;
LUCI-TryBot-Result: Go LUCI &lt;golang-scoped@luci-project-accounts.iam.gserviceaccount.com&gt;
Reviewed-by: Ian Lance Taylor &lt;iant@google.com&gt;
Auto-Submit: Ian Lance Taylor &lt;iant@google.com&gt;
</content>
</entry>
<entry>
<title>bytes: skip TestNewBufferShallow if optimization is disabled</title>
<updated>2024-04-26T13:31:36Z</updated>
<author>
<name>qmuntal</name>
<email>quimmuntal@gmail.com</email>
</author>
<published>2024-04-26T07:38:44Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=5ff0b531748fcdc88d6667e55e021fe02e0c0089'/>
<id>urn:sha1:5ff0b531748fcdc88d6667e55e021fe02e0c0089</id>
<content type='text'>
TestNewBufferShallow should be skipped if optimization is disabled.

It is currently failing on no-opt builders.

Change-Id: Ib5e62022a56a4e5f158f247d69a6229d2cb4d99e
Reviewed-on: https://go-review.googlesource.com/c/go/+/581915
Auto-Submit: Than McIntosh &lt;thanm@google.com&gt;
Reviewed-by: Than McIntosh &lt;thanm@google.com&gt;
Auto-Submit: Quim Muntal &lt;quimmuntal@gmail.com&gt;
LUCI-TryBot-Result: Go LUCI &lt;golang-scoped@luci-project-accounts.iam.gserviceaccount.com&gt;
Reviewed-by: Joedian Reid &lt;joedian@google.com&gt;
</content>
</entry>
<entry>
<title>bytes: add test to ensure shallow copy of NewBuffer does not allocate</title>
<updated>2024-04-24T13:36:51Z</updated>
<author>
<name>Joe Tsai</name>
<email>joetsai@digital-static.net</email>
</author>
<published>2024-04-23T22:42:22Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=62dfa43101ce0abe5c919b4c996a9ba157e6a5e0'/>
<id>urn:sha1:62dfa43101ce0abe5c919b4c996a9ba157e6a5e0</id>
<content type='text'>
At present, there is no API to reset the underlying []byte
of an existing Buffer struct, except to shallow copy
the entire Buffer struct.

Updates #67004

Change-Id: I08998f7a95ae5bde0897d86247d47f23cd784583
Reviewed-on: https://go-review.googlesource.com/c/go/+/581297
Auto-Submit: Joseph Tsai &lt;joetsai@digital-static.net&gt;
Reviewed-by: Joedian Reid &lt;joedian@google.com&gt;
TryBot-Result: Gopher Robot &lt;gobot@golang.org&gt;
Reviewed-by: Keith Randall &lt;khr@google.com&gt;
Run-TryBot: Joseph Tsai &lt;joetsai@digital-static.net&gt;
Reviewed-by: Keith Randall &lt;khr@golang.org&gt;
LUCI-TryBot-Result: Go LUCI &lt;golang-scoped@luci-project-accounts.iam.gserviceaccount.com&gt;
</content>
</entry>
<entry>
<title>std: fix various nilness findings</title>
<updated>2023-04-20T01:07:29Z</updated>
<author>
<name>Alan Donovan</name>
<email>adonovan@google.com</email>
</author>
<published>2023-04-19T22:48:00Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=9d35ebba062cae9cc7bd716ad279ac7d44060a93'/>
<id>urn:sha1:9d35ebba062cae9cc7bd716ad279ac7d44060a93</id>
<content type='text'>
Found by running
$ go run golang.org/x/tools/go/analysis/passes/nilness/cmd/nilness@latest std

No actual bugs--other than one panic(nil)--but a
few places where error nilness was unclear.

Change-Id: Ia916ba30f46f29c1bcf928cc62280169b922463a
Reviewed-on: https://go-review.googlesource.com/c/go/+/486675
Reviewed-by: Ian Lance Taylor &lt;iant@google.com&gt;
Run-TryBot: Alan Donovan &lt;adonovan@google.com&gt;
TryBot-Result: Gopher Robot &lt;gobot@golang.org&gt;
Auto-Submit: Alan Donovan &lt;adonovan@google.com&gt;
</content>
</entry>
<entry>
<title>bytes: add Buffer.Available and Buffer.AvailableBuffer</title>
<updated>2023-03-13T17:03:14Z</updated>
<author>
<name>Joe Tsai</name>
<email>joetsai@digital-static.net</email>
</author>
<published>2023-02-06T19:37:39Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=e671fe0c3efc497397af3362a4b79c895fbd8bfc'/>
<id>urn:sha1:e671fe0c3efc497397af3362a4b79c895fbd8bfc</id>
<content type='text'>
This adds a new Buffer.AvailableBuffer method that returns
an empty buffer with a possibly non-empty capacity for use
with append-like APIs.

The typical usage pattern is something like:

	b := bb.AvailableBuffer()
	b = appendValue(b, v)
	bb.Write(b)

It allows logic combining append-like APIs with Buffer
to avoid needing to allocate and manage buffers themselves and
allows the append-like APIs to directly write into the Buffer.

The Buffer.Write method uses the builtin copy function,
which avoids copying bytes if the source and destination are identical.
Thus, Buffer.Write is a constant-time call for this pattern.

Performance:

	BenchmarkBufferAppendNoCopy  2.909 ns/op  5766942167.24 MB/s

This benchmark should only be testing the cost of bookkeeping
and never the copying of the input slice.
Thus, the MB/s should be orders of magnitude faster than RAM.

Fixes #53685

Change-Id: I0b41e54361339df309db8d03527689b123f99085
Reviewed-on: https://go-review.googlesource.com/c/go/+/474635
Run-TryBot: Joseph Tsai &lt;joetsai@digital-static.net&gt;
Reviewed-by: Daniel Martí &lt;mvdan@mvdan.cc&gt;
Reviewed-by: Cherry Mui &lt;cherryyz@google.com&gt;
TryBot-Result: Gopher Robot &lt;gobot@golang.org&gt;
Auto-Submit: Joseph Tsai &lt;joetsai@digital-static.net&gt;
Reviewed-by: Ian Lance Taylor &lt;iant@google.com&gt;
</content>
</entry>
<entry>
<title>bytes: rely on runtime.growslice for growing</title>
<updated>2022-03-10T16:24:16Z</updated>
<author>
<name>Joe Tsai</name>
<email>joetsai@digital-static.net</email>
</author>
<published>2021-09-14T21:26:11Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=2d026a4ea5b28680c1ed7660f720c4cb028c5b35'/>
<id>urn:sha1:2d026a4ea5b28680c1ed7660f720c4cb028c5b35</id>
<content type='text'>
Rather than naively making a slice of capacity 2*c+n,
rely on the append(..., make(...)) pattern to allocate a
slice that aligns up to the closest size class.

Performance:
	name                          old time/op    new time/op    delta
	BufferWriteBlock/N4096       3.03µs ± 6%    2.04µs ± 6%  -32.60%  (p=0.000 n=10+10)
	BufferWriteBlock/N65536      47.8µs ± 6%    28.1µs ± 2%  -41.32%  (p=0.000 n=9+8)
	BufferWriteBlock/N1048576     844µs ± 7%     510µs ± 5%  -39.59%  (p=0.000 n=8+9)

	name                          old alloc/op   new alloc/op   delta
	BufferWriteBlock/N4096       12.3kB ± 0%     7.2kB ± 0%  -41.67%  (p=0.000 n=10+10)
	BufferWriteBlock/N65536       258kB ± 0%     130kB ± 0%  -49.60%  (p=0.000 n=10+10)
	BufferWriteBlock/N1048576    4.19MB ± 0%    2.10MB ± 0%  -49.98%  (p=0.000 n=10+8)

	name                          old allocs/op  new allocs/op  delta
	BufferWriteBlock/N4096         3.00 ± 0%      3.00 ± 0%     ~     (all equal)
	BufferWriteBlock/N65536        7.00 ± 0%      7.00 ± 0%     ~     (all equal)
	BufferWriteBlock/N1048576      11.0 ± 0%      11.0 ± 0%     ~     (all equal)

The performance is faster since the growth rate is capped at 2x,
while previously it could grow by amounts potentially much greater than 2x,
leading to significant amounts of memory waste and extra copying.

Credit goes to Martin Möhrmann for suggesting the
append(b, make([]T, n)...) pattern.

Fixes #42984
Updates #51462

Change-Id: I7b23f75dddbf53f8b8b93485bb1a1fff9649b96b
Reviewed-on: https://go-review.googlesource.com/c/go/+/349994
Trust: Joseph Tsai &lt;joetsai@digital-static.net&gt;
Trust: Josh Bleecher Snyder &lt;josharian@gmail.com&gt;
Reviewed-by: Bryan Mills &lt;bcmills@google.com&gt;
Reviewed-by: Ian Lance Taylor &lt;iant@golang.org&gt;
Reviewed-by: Josh Bleecher Snyder &lt;josharian@gmail.com&gt;
</content>
</entry>
<entry>
<title>bufio, bytes, strings: handle negative runes in WriteRune</title>
<updated>2021-02-24T04:01:25Z</updated>
<author>
<name>David Benjamin</name>
<email>davidben@google.com</email>
</author>
<published>2020-12-25T17:02:04Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=43652dc46f770253b3603f47165b1568b439b0b5'/>
<id>urn:sha1:43652dc46f770253b3603f47165b1568b439b0b5</id>
<content type='text'>
Updates #43254

Change-Id: I7d4bf3b99cc36ca2156af5bb01a1c595419d1d3c
Reviewed-on: https://go-review.googlesource.com/c/go/+/280492
Reviewed-by: Emmanuel Odeke &lt;emmanuel@orijtech.com&gt;
Reviewed-by: Rob Pike &lt;r@golang.org&gt;
Trust: Emmanuel Odeke &lt;emmanuel@orijtech.com&gt;
Run-TryBot: Emmanuel Odeke &lt;emmanuel@orijtech.com&gt;
TryBot-Result: Go Bot &lt;gobot@golang.org&gt;
</content>
</entry>
<entry>
<title>bytes: deflake TestGrow by using testing.AllocsPerRun</title>
<updated>2020-02-26T18:40:56Z</updated>
<author>
<name>HowJMay</name>
<email>vulxj0j8j8@gmail.com</email>
</author>
<published>2020-02-26T18:19:18Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=75619d199f88bc4d411cefcf5735cbbff78d1ae2'/>
<id>urn:sha1:75619d199f88bc4d411cefcf5735cbbff78d1ae2</id>
<content type='text'>
Fixes #36695

Change-Id: I4392246015252018b49f321a5a839cc68cc611d7
GitHub-Last-Rev: c2fb1f7ddbe9b80059eed69f31781abe0a1db185
GitHub-Pull-Request: golang/go#36732
Reviewed-on: https://go-review.googlesource.com/c/go/+/216237
Reviewed-by: Bryan C. Mills &lt;bcmills@google.com&gt;
Run-TryBot: Bryan C. Mills &lt;bcmills@google.com&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
</content>
</entry>
<entry>
<title>bytes: clean up a test</title>
<updated>2019-02-26T23:16:46Z</updated>
<author>
<name>Leon Klingele</name>
<email>git@leonklingele.de</email>
</author>
<published>2019-02-03T16:07:39Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=97f81572c4a97b6539f0a7b3ca3089daf3d6b4c3'/>
<id>urn:sha1:97f81572c4a97b6539f0a7b3ca3089daf3d6b4c3</id>
<content type='text'>
Change-Id: Iaa0e1721996b582bba9509c083755e1f125abb6b
GitHub-Last-Rev: c9b13ec0cdc2b22aafa54706dc6df6113a11712b
GitHub-Pull-Request: golang/go#29996
Reviewed-on: https://go-review.googlesource.com/c/160420
Run-TryBot: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
Reviewed-by: Keith Randall &lt;khr@golang.org&gt;
</content>
</entry>
</feed>
