Replace sort.Slice in some places #1471

Merged
dstepanov-yadro merged 1 commit from fyrchik/frostfs-node:slices into master 2024-11-06 08:07:35 +00:00
Owner

slices.SortFunc doesn't use reflection and is a bit faster.
I have done some micro-benchmarks for []NodeInfo:

$ benchstat -col "/func" out
goos: linux
goarch: amd64
pkg: git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/pilorama
cpu: 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
       │ sort.Slice  │           slices.SortFunc           │
       │   sec/op    │   sec/op     vs base                │
Sort-8   2.130µ ± 2%   1.253µ ± 2%  -41.20% (p=0.000 n=10)

Haven't included them, though, as they I don't see them being used a
lot.

Signed-off-by: Evgenii Stratonikov e.stratonikov@yadro.com

`slices.SortFunc` doesn't use reflection and is a bit faster. I have done some micro-benchmarks for `[]NodeInfo`: ``` $ benchstat -col "/func" out goos: linux goarch: amd64 pkg: git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/pilorama cpu: 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz │ sort.Slice │ slices.SortFunc │ │ sec/op │ sec/op vs base │ Sort-8 2.130µ ± 2% 1.253µ ± 2% -41.20% (p=0.000 n=10) ``` Haven't included them, though, as they I don't see them being used a lot. Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
fyrchik added 1 commit 2024-11-06 07:36:36 +00:00
Replace sort.Slice in some places
Some checks failed
DCO action / DCO (pull_request) Failing after 3m0s
Pre-commit hooks / Pre-commit (pull_request) Successful in 3m38s
Vulncheck / Vulncheck (pull_request) Successful in 3m30s
Tests and linters / Run gofumpt (pull_request) Successful in 3m40s
Tests and linters / gopls check (pull_request) Successful in 3m51s
Tests and linters / Staticcheck (pull_request) Successful in 4m17s
Tests and linters / Lint (pull_request) Successful in 4m52s
Build / Build Components (pull_request) Successful in 5m10s
Tests and linters / Tests (pull_request) Successful in 8m14s
Tests and linters / Tests with -race (pull_request) Successful in 8m48s
ecea8ab8be
`slices.SortFunc` doesn't use reflection and is a bit faster.
I have done some micro-benchmarks for `[]NodeInfo`:
```
$ benchstat -col "/func" out
goos: linux
goarch: amd64
pkg: git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/pilorama
cpu: 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
       │ sort.Slice  │           slices.SortFunc           │
       │   sec/op    │   sec/op     vs base                │
Sort-8   2.130µ ± 2%   1.253µ ± 2%  -41.20% (p=0.000 n=10)
```

Haven't included them, though, as they I don't see them being used a
lot.

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
fyrchik requested review from storage-core-committers 2024-11-06 07:36:59 +00:00
fyrchik force-pushed slices from ecea8ab8be to cfa2334af5 2024-11-06 07:37:00 +00:00 Compare
fyrchik added this to the v0.44.0 milestone 2024-11-06 07:37:02 +00:00
fyrchik requested review from storage-core-developers 2024-11-06 07:37:04 +00:00
dstepanov-yadro approved these changes 2024-11-06 07:45:58 +00:00
achuprov approved these changes 2024-11-06 07:52:01 +00:00
dstepanov-yadro merged commit 15102e6dfd into master 2024-11-06 08:07:35 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/frostfs-node#1471
No description provided.