Skip to content

Commit

Permalink
dev: improve benchmark scripts (#4826)
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez committed Jun 20, 2024
1 parent 45efa67 commit dbd0935
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions scripts/bench/bench_local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ mv "temp-${VERSION}/golangci-lint" "./golangci-lint-${VERSION}"
rm -rf "temp-${VERSION}"

## Build local version
## use `go build` to set ldflags (it reduces some performance differences with binaries created by goreleaser)

make build
go build -trimpath -ldflags '-s -w' -o golangci-lint ./cmd/golangci-lint

## Run

hyperfine \
--prepare './golangci-lint cache clean' "./golangci-lint run --issues-exit-code 0 --print-issued-lines=false --enable-only ${LINTER}" \
--prepare "./golangci-lint-${VERSION} cache clean" "./golangci-lint-${VERSION} run --issues-exit-code 0 --print-issued-lines=false --enable-only ${LINTER}"

hyperfine --warmup 1 \
-n 'local' --prepare './golangci-lint cache clean' "./golangci-lint run --issues-exit-code 0 --print-issued-lines=false --enable-only ${LINTER}" \
-n "${VERSION}" --prepare "./golangci-lint-${VERSION} cache clean" "./golangci-lint-${VERSION} run --issues-exit-code 0 --print-issued-lines=false --enable-only ${LINTER}"
6 changes: 3 additions & 3 deletions scripts/bench/bench_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ install "${VERSION_NEW}"

## Run

hyperfine \
--prepare "./golangci-lint-${VERSION_OLD} cache clean" "./golangci-lint-${VERSION_OLD} run --issues-exit-code 0 --print-issued-lines=false --enable-only ${LINTER}" \
--prepare "./golangci-lint-${VERSION_NEW} cache clean" "./golangci-lint-${VERSION_NEW} run --issues-exit-code 0 --print-issued-lines=false --enable-only ${LINTER}"
hyperfine --warmup 1 \
-n "${VERSION_OLD}" --prepare "./golangci-lint-${VERSION_OLD} cache clean" "./golangci-lint-${VERSION_OLD} run --issues-exit-code 0 --print-issued-lines=false --enable-only ${LINTER}" \
-n "${VERSION_NEW}" --prepare "./golangci-lint-${VERSION_NEW} cache clean" "./golangci-lint-${VERSION_NEW} run --issues-exit-code 0 --print-issued-lines=false --enable-only ${LINTER}"

0 comments on commit dbd0935

Please sign in to comment.