aboutsummaryrefslogtreecommitdiff
path: root/src/plugin
diff options
context:
space:
mode:
authorMartin Möhrmann <moehrmann@google.com>2018-11-07 09:33:12 +0100
committerMartin Möhrmann <moehrmann@google.com>2019-03-18 14:05:54 +0000
commit6ca51f78978de7e6206d38b99eef8172fc8540d0 (patch)
tree1d612af0e3c1fa3d55e9777c55975a3bbff49d27 /src/plugin
parente5f6e2d1c8ae540504e1728a5449af3715bf27eb (diff)
downloadgo-6ca51f78978de7e6206d38b99eef8172fc8540d0.tar.xz
runtime: replace division by span element size by multiply and shifts
Divisions are generally slow. The compiler can optimize a division to use a sequence of faster multiplies and shifts (magic constants) if the divisor is not know at compile time. The value of the span element size in mcentral.grow is not known at compile time but magic constants to compute n / span.elementsize are already stored in class_to_divmagic and mspan. They however need to be adjusted to work for (0 <= n <= span.npages * pagesize) instead of (0 <= n < span.npages * pagesize). Change-Id: Ieea59f1c94525a88d012f2557d43691967900deb Reviewed-on: https://go-review.googlesource.com/c/go/+/148057 Run-TryBot: Martin Möhrmann <moehrmann@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com> Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/plugin')
0 files changed, 0 insertions, 0 deletions