Skip to content

benchmark

benchmark #942

Workflow file for this run

name: benchmark
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
push:
branches:
- master
jobs:
benchmark:
runs-on: ubuntu-latest
steps:
- name: install go tip
run: |
curl --head https://github.com/phuslu/go/releases/download/v0.0.0/gotip.linux-amd64.tar.xz
curl -sSLf https://github.com/phuslu/go/releases/download/v0.0.0/gotip.linux-amd64.tar.xz | tar xJ -C .
sudo mv go /usr/local/go
sudo ln -sf /usr/local/go/bin/go /usr/bin/go
- uses: actions/checkout@v4
- name: go mod tidy
run: |
mkdir bench
cd bench
awk '{if($0 ~ "// env writeratio="){a=1;b=1};if($0 ~ "```" && b=1){b=0};if (a&&b) {print}}' ../README.md | tee bench_test.go
go mod init bench
go mod tidy
go mod edit -replace github.com/phuslu/lru=../
cat go.mod
- name: Throughput benchmarks
working-directory: ./bench
run: |
# env writeratio=0.05 zipfian=false go test -v -cpu=8 -run=none -bench=. -benchtime=5s -benchmem bench_test.go
env writeratio=0.05 zipfian=true go test -v -cpu=8 -run=none -bench=. -benchtime=5s -benchmem bench_test.go