aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/debug
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2024-05-22 13:38:40 -0700
committerGopher Robot <gobot@golang.org>2024-05-23 01:00:11 +0000
commitb0b1d42db32a992150dd26681d3bda222e108303 (patch)
treef520827bed796e2b0edc4cd91b2ac6dce89c718b /src/runtime/debug
parent1849ce6a45640ec4a6e63138211eac4276473437 (diff)
downloadgo-b0b1d42db32a992150dd26681d3bda222e108303.tar.xz
all: change from sort functions to slices functions where feasible
Doing this because the slices functions are slightly faster and slightly easier to use. It also removes one dependency layer. This CL does not change packages that are used during bootstrap, as the bootstrap compiler does not have the required slices functions. It does not change the go/scanner package because the ErrorList Len, Swap, and Less methods are part of the Go 1 API. Change-Id: If52899be791c829198e11d2408727720b91ebe8a Reviewed-on: https://go-review.googlesource.com/c/go/+/587655 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Commit-Queue: Ian Lance Taylor <iant@google.com> Reviewed-by: Damien Neil <dneil@google.com>
Diffstat (limited to 'src/runtime/debug')
-rw-r--r--src/runtime/debug/garbage.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/runtime/debug/garbage.go b/src/runtime/debug/garbage.go
index 4f11c58733..ec74ba0165 100644
--- a/src/runtime/debug/garbage.go
+++ b/src/runtime/debug/garbage.go
@@ -6,7 +6,7 @@ package debug
import (
"runtime"
- "sort"
+ "slices"
"time"
)
@@ -69,7 +69,7 @@ func ReadGCStats(stats *GCStats) {
// See the allocation at the top of the function.
sorted := stats.Pause[n : n+n]
copy(sorted, stats.Pause)
- sort.Slice(sorted, func(i, j int) bool { return sorted[i] < sorted[j] })
+ slices.Sort(sorted)
nq := len(stats.PauseQuantiles) - 1
for i := 0; i < nq; i++ {
stats.PauseQuantiles[i] = sorted[len(sorted)*i/nq]