]> Cypherpunks repositories - gostls13.git/commit
sync: align poolLocal to CPU cache line size
authorAliaksandr Valialkin <valyala@gmail.com>
Tue, 18 Apr 2017 10:12:58 +0000 (13:12 +0300)
committerIan Lance Taylor <iant@golang.org>
Thu, 20 Apr 2017 22:36:07 +0000 (22:36 +0000)
commit8aa31d5dae9644b3e8f6950af58c0cb83e8fc062
treeeda2595dcd95ca98c82265b290744a6175c498ed
parent3218b1aa6fffef560147bcbbcb313a5c8a5e0d76
sync: align poolLocal to CPU cache line size

Make poolLocal size multiple of 128, so it aligns to CPU cache line
on the most common architectures.

This also has the following benefits:

- It may help compiler substituting integer multiplication
  by bit shift inside indexLocal.
- It shrinks poolLocal size from 176 bytes to 128 bytes on amd64,
  so now it fits two cache lines (or a single cache line on certain
  Intel CPUs - see https://software.intel.com/en-us/articles/optimizing-application-performance-on-intel-coret-microarchitecture-using-hardware-implemented-prefetchers).

No measurable performance changes on linux/amd64 and linux/386.

Change-Id: I11df0f064718a662e77a85d88b8a15a8919f25e9
Reviewed-on: https://go-review.googlesource.com/40918
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/sync/pool.go