1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-16 03:52:12 +02:00
goreleaser/internal/pipe
Eng Zer Jun b8aef100f2
perf(changelog): improve changelog sort performance (#5161)
This commit removes the unnecessary slice copy in `sortEntries`, and
replaces `sort.Slice` [^1] with the new `slices.SortFunc` [^2].

As recommended by the Go documentation, `slices.SortFunc` is generally
faster because it uses generic, whereas `sort.Slice` relies on
reflection, which incurs additional allocations

The benchmark result from the newly added `Benchmark_sortEntries` show
approximately a 64% performance improvement.


Benchmark result:

```
                     │   old.txt    │               new.txt               │
                     │    sec/op    │   sec/op     vs base                │
_sortEntries/asc-16    16.458µ ± 1%   5.958µ ± 1%  -63.80% (p=0.000 n=10)
_sortEntries/desc-16   17.675µ ± 1%   6.020µ ± 0%  -65.94% (p=0.000 n=10)
geomean                 17.06µ        5.989µ       -64.89%

                     │   old.txt    │               new.txt                │
                     │     B/op     │     B/op      vs base                │
_sortEntries/asc-16    3.164Ki ± 0%   1.164Ki ± 0%  -63.21% (p=0.000 n=10)
_sortEntries/desc-16   3.422Ki ± 0%   1.164Ki ± 0%  -65.98% (p=0.000 n=10)
geomean                3.290Ki        1.164Ki       -64.62%

                     │  old.txt   │              new.txt               │
                     │ allocs/op  │ allocs/op   vs base                │
_sortEntries/asc-16    68.00 ± 0%   25.00 ± 0%  -63.24% (p=0.000 n=10)
_sortEntries/desc-16   72.00 ± 0%   25.00 ± 0%  -65.28% (p=0.000 n=10)
geomean                69.97        25.00       -64.27%
```

[^1]: https://pkg.go.dev/sort#Slice
[^2]: https://pkg.go.dev/slices#SortFunc

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2024-09-30 13:27:29 -03:00
..
announce feat!: rename module to /v2 (#4894) 2024-05-26 15:02:57 -03:00
archive feat: --skip=archive (#4916) 2024-06-11 09:23:21 -03:00
artifactory feat!: rename module to /v2 (#4894) 2024-05-26 15:02:57 -03:00
aur feat!: rename module to /v2 (#4894) 2024-05-26 15:02:57 -03:00
before feat!: rename module to /v2 (#4894) 2024-05-26 15:02:57 -03:00
blob test: check if pre-requisites are installed (#5109) 2024-09-03 20:39:33 -03:00
bluesky fix: snapshot version template should not have the leading 'v' 2024-09-19 23:55:10 -03:00
brew feat: default GOARM change to 7 (#5157) 2024-09-27 13:31:29 -03:00
build fix(build): c-shared build and release when target is wasm (#5128) 2024-09-09 22:25:54 -03:00
changelog perf(changelog): improve changelog sort performance (#5161) 2024-09-30 13:27:29 -03:00
checksums fix: moving some logs to debug 2024-06-22 22:43:57 -03:00
chocolatey test: update golden files 2024-09-27 10:33:17 -03:00
custompublishers feat!: rename module to /v2 (#4894) 2024-05-26 15:02:57 -03:00
defaults feat: when --clean, remove dist before checking git state (#5057) 2024-08-08 10:14:29 -03:00
discord feat!: rename module to /v2 (#4894) 2024-05-26 15:02:57 -03:00
dist feat: when --clean, remove dist before checking git state (#5057) 2024-08-08 10:14:29 -03:00
docker feat: default GOARM change to 7 (#5157) 2024-09-27 13:31:29 -03:00
effectiveconfig test: fix 2024-06-26 08:52:22 -03:00
env feat!: rename module to /v2 (#4894) 2024-05-26 15:02:57 -03:00
git feat!: rename module to /v2 (#4894) 2024-05-26 15:02:57 -03:00
gomod build: use go 1.23 (#5082) 2024-08-18 16:08:55 -03:00
ko feat(ko): snapshot builds (#5116) 2024-09-07 11:15:48 -03:00
krew feat!: rename module to /v2 (#4894) 2024-05-26 15:02:57 -03:00
linkedin feat!: rename module to /v2 (#4894) 2024-05-26 15:02:57 -03:00
mastodon feat!: rename module to /v2 (#4894) 2024-05-26 15:02:57 -03:00
mattermost chore: fix linter errors (#5111) 2024-08-30 17:03:10 -03:00
metadata fix: moving some logs to debug 2024-06-22 22:43:57 -03:00
milestone feat!: rename module to /v2 (#4894) 2024-05-26 15:02:57 -03:00
nfpm feat(nfpm): better support aix (#5075) 2024-08-18 16:58:12 -03:00
nix chore: auto-update generated files 2024-09-12 19:43:42 +00:00
notary feat(notary): allow to sign without notarizing (#4919) 2024-06-11 09:20:48 -03:00
opencollective feat!: rename module to /v2 (#4894) 2024-05-26 15:02:57 -03:00
partial feat: default GOARM change to 7 (#5157) 2024-09-27 13:31:29 -03:00
prebuild feat!: rename module to /v2 (#4894) 2024-05-26 15:02:57 -03:00
project feat!: rename module to /v2 (#4894) 2024-05-26 15:02:57 -03:00
publish feat!: rename module to /v2 (#4894) 2024-05-26 15:02:57 -03:00
reddit feat!: rename module to /v2 (#4894) 2024-05-26 15:02:57 -03:00
release fix: moving some logs to debug 2024-06-22 22:43:57 -03:00
reportsizes feat!: rename module to /v2 (#4894) 2024-05-26 15:02:57 -03:00
sbom feat!: rename module to /v2 (#4894) 2024-05-26 15:02:57 -03:00
scoop feat!: rename module to /v2 (#4894) 2024-05-26 15:02:57 -03:00
semver feat!: rename module to /v2 (#4894) 2024-05-26 15:02:57 -03:00
sign fix: signature template failed silently after signing process completed (#5148) 2024-09-23 09:14:26 -03:00
slack feat!: rename module to /v2 (#4894) 2024-05-26 15:02:57 -03:00
smtp feat!: rename module to /v2 (#4894) 2024-05-26 15:02:57 -03:00
snapcraft fix: improve snapcraft configuration handling 2024-07-13 14:09:46 -03:00
snapshot fix: snapshot version template should not have the leading 'v' 2024-09-19 23:55:10 -03:00
sourcearchive fix: consistent logging of source archive path 2024-07-24 09:58:42 -04:00
teams feat!: rename module to /v2 (#4894) 2024-05-26 15:02:57 -03:00
telegram feat!: rename module to /v2 (#4894) 2024-05-26 15:02:57 -03:00
twitter feat!: rename module to /v2 (#4894) 2024-05-26 15:02:57 -03:00
universalbinary feat!: rename module to /v2 (#4894) 2024-05-26 15:02:57 -03:00
upload feat!: rename module to /v2 (#4894) 2024-05-26 15:02:57 -03:00
upx fix: upx UnknownExecutableFormatException 2024-09-17 09:30:49 -03:00
webhook chore: fix linter errors (#5111) 2024-08-30 17:03:10 -03:00
winget feat!: rename module to /v2 (#4894) 2024-05-26 15:02:57 -03:00
pipe_test.go test: simplify error asserts with require.ErrorContains (#4640) 2024-02-19 16:28:06 -03:00
pipe.go docs: remove mentions to --skip-something flags 2024-05-09 23:18:53 -03:00