From b0b1d42db32a992150dd26681d3bda222e108303 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 22 May 2024 13:38:40 -0700 Subject: 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 Reviewed-by: Ian Lance Taylor Auto-Submit: Ian Lance Taylor Commit-Queue: Ian Lance Taylor Reviewed-by: Damien Neil --- src/runtime/debug/garbage.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/runtime/debug') 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] -- cgit v1.3-5-g45d5