]> Cypherpunks repositories - gostls13.git/commit
runtime: hoist invariant code out of heapBitsSmallForAddrInline
authorArchana Ravindar <aravinda@redhat.com>
Fri, 7 Nov 2025 07:45:02 +0000 (13:15 +0530)
committerArchana Ravindar <aravinda@redhat.com>
Mon, 17 Nov 2025 17:29:39 +0000 (09:29 -0800)
commit65c09eafdf316ef691f0f8eccbf860d2ef5f7c70
treed0317f13f9f1dae6882e1d7bb6642d12b0bf36e4
parent594129b80cad4eb291a4185f3ac81699cfb3afd6
runtime: hoist invariant code out of heapBitsSmallForAddrInline

The first two instructions in heapBitsSmallForAddrInline are
invariant for a given span and object and are called in
a loop within ScanObjectsSmall which figures as a hot routine
in profiles of some benchmark runs within sweet benchmark suite
(x/benchmarks/sweet), Ideally it would have been great if the
compiler hoisted this code out of the loop, Moving it out of
inner loop manually gives gains (moving it entirely out of
nested loop does not improve performance, in some cases it
even regresses it perhaps due to the early loop exit).
Tested with AMD64, ARM64, PPC64LE and S390x

Fixes #76212

Change-Id: I49c3c826b9d7bf3125ffc42c8c174cce0ecc4cbf
Reviewed-on: https://go-review.googlesource.com/c/go/+/718680
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
src/runtime/mgcmark_greenteagc.go