Files
Dmitry Verkhoturov 07c7926453 Update backend dependencies to latest
Update all Go modules in backend/ and backend/_example/memory_store/ to
their latest versions (chroma 2.27, go-redis 9.21, bbolt 1.5, slack 0.27,
golang.org/x/* and others); re-tidy and re-vendor, keep the example module
in sync.

Hold github.com/go-chi/chi/v5 at v5.2.5: v5.3.0 deprecates
middleware.RealIP (IP-spoofing advisories). Switching off RealIP changes
how the client IP is derived for rate limiting and votes, which is a
security decision better made on its own rather than inside a dependency
bump.

go test -race, go vet, golangci-lint and govulncheck all clean on both
modules.
2026-06-30 18:35:31 +01:00

65 lines
2.2 KiB
YAML

version: '3'
tasks:
benchcmp:
desc: Compare current benchmarks against an optional commit, defaulting to HEAD
vars:
BENCH_COUNT: '{{default "5" .COUNT}}'
REF:
sh: |
if [ -n "{{.COMMIT}}" ]; then
printf '%s\n' "{{.COMMIT}}"
elif [ -n "{{.CLI_ARGS}}" ]; then
set -- {{.CLI_ARGS}}
printf '%s\n' "$1"
else
printf '%s\n' HEAD
fi
COMMIT_HASH:
sh: git rev-parse --verify "{{.REF}}^{commit}"
cmds:
- |
set -eu
mkdir -p benchmarks
base_file="benchmarks/{{.COMMIT_HASH}}-count{{.BENCH_COUNT}}.txt"
new_file="benchmarks/new.txt"
base_tmp=""
new_tmp=""
worktree_dir="$(mktemp -d /tmp/regexp2-benchcmp.XXXXXX)"
cleanup() {
if [ -n "$base_tmp" ]; then
rm -f "$base_tmp"
fi
if [ -n "$new_tmp" ]; then
rm -f "$new_tmp"
fi
git worktree remove --force "$worktree_dir" >/dev/null 2>&1 || true
}
trap cleanup EXIT
if [ -f "$base_file" ] && grep -q '^Benchmark' "$base_file"; then
printf 'Using cached baseline benchmarks from %s...\n' "$base_file"
else
if [ -f "$base_file" ]; then
printf 'Ignoring cached baseline without benchmark results at %s...\n' "$base_file"
fi
printf 'Running baseline benchmarks for %s (%s samples)...\n' "{{.COMMIT_HASH}}" "{{.BENCH_COUNT}}"
git worktree add --detach "$worktree_dir" "{{.COMMIT_HASH}}"
base_tmp="$(mktemp "${base_file}.tmp.XXXXXX")"
(cd "$worktree_dir" && env GOWORK=off go test -run '^$' -bench . -benchmem -count "{{.BENCH_COUNT}}" ./...) > "$base_tmp"
mv "$base_tmp" "$base_file"
base_tmp=""
fi
printf 'Running current benchmarks (%s samples)...\n' "{{.BENCH_COUNT}}"
new_tmp="$(mktemp "${new_file}.tmp.XXXXXX")"
env GOWORK=off go test -run '^$' -bench . -benchmem -count "{{.BENCH_COUNT}}" ./... > "$new_tmp"
mv "$new_tmp" "$new_file"
new_tmp=""
printf 'Comparing benchmark results with benchstat...\n'
benchstat "$base_file" "$new_file"