]> Cypherpunks repositories - gostls13.git/commit
runtime: optimize growslice
authorEgon Elbre <egonelbre@gmail.com>
Tue, 9 May 2023 08:29:51 +0000 (11:29 +0300)
committerGopher Robot <gobot@golang.org>
Mon, 4 Sep 2023 17:50:46 +0000 (17:50 +0000)
commitc56f463412428f8a4d06bf67da9059b389c8d526
treeefbaa4d9f0a047ca58103b3e2f9cb4f4deb3ace4
parent778f5fc0793e72aaf70f2331566f45cb858e57b6
runtime: optimize growslice

This is tiny optimization for growslice, which is probably too small to
measure easily.

Move the for loop to avoid multiple checks inside the loop.
Also, use >> 2 instead of /4, which generates fewer instructions.

Change-Id: I9ab09bdccb56f98ab22073f23d9e102c252238c7
Reviewed-on: https://go-review.googlesource.com/c/go/+/493795
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Egon Elbre <egonelbre@gmail.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
src/runtime/slice.go