]> Cypherpunks repositories - gostls13.git/commit
internal/sync: optimize CompareAndSwap and Swap
authorMichael Anthony Knyszek <mknyszek@google.com>
Fri, 16 Aug 2024 15:13:52 +0000 (15:13 +0000)
committerGopher Robot <gobot@golang.org>
Mon, 18 Nov 2024 20:35:39 +0000 (20:35 +0000)
commit06e6b8efa4c9fbe4b8ceec8c655011117a50279a
treee697f72cdb720dfcd30c46a8deefa3af1e7b2a87
parent50f1888814e2a72cb368c145a0d1c2f3af7a2f05
internal/sync: optimize CompareAndSwap and Swap

We observe the CompareAndSwap and Swap can both be substantially faster
if the value in each entry node is mutable. This change modifies the
map entry node to store the value indirectly, allowing us to perform
swaps for existing nodes and compare-and-swaps without taking the
parent node's lock.

Change-Id: I371343aa81a843d3a7e6bc5ac87b8a96c12ca3a8
Reviewed-on: https://go-review.googlesource.com/c/go/+/606462
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
src/internal/sync/hashtriemap.go