From dbd09352209a5c4e9bc2c721342d69cb7db20a51 Mon Sep 17 00:00:00 2001 From: Ludovic Fernandez Date: Thu, 20 Jun 2024 22:49:50 +0200 Subject: [PATCH] dev: improve benchmark scripts (#4826) --- scripts/bench/bench_local.sh | 10 +++++----- scripts/bench/bench_version.sh | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/bench/bench_local.sh b/scripts/bench/bench_local.sh index 6c5d69e8..dd77d6d8 100755 --- a/scripts/bench/bench_local.sh +++ b/scripts/bench/bench_local.sh @@ -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}" diff --git a/scripts/bench/bench_version.sh b/scripts/bench/bench_version.sh index 29067ee7..a7ce5949 100755 --- a/scripts/bench/bench_version.sh +++ b/scripts/bench/bench_version.sh @@ -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}"