github.com/phuslu/lru@v1.0.16-0.20240421170520-46288a2fd47c/.github/workflows/benchmark.yml (about)

     1  name: benchmark
     2  
     3  on:
     4    schedule:
     5      - cron: '0 0 * * *'
     6    push:
     7      branches:
     8        - master
     9  
    10  jobs:
    11    benchmark:
    12      runs-on: ubuntu-latest
    13      steps:
    14        - uses: actions/setup-go@v4
    15          with:
    16            go-version: '1.22'
    17            check-latest: true
    18        - uses: actions/checkout@v4
    19        - name: go mod tidy
    20          run: |
    21            mkdir bench
    22            cd bench
    23            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
    24            go mod init bench
    25            go mod tidy
    26            go mod edit -replace github.com/phuslu/lru=../
    27            cat go.mod
    28        - name: Throughput benchmarks
    29          working-directory: ./bench
    30          run: |
    31            env writeratio=0.1 zipfian=false go test -v -cpu=8 -run=none -bench=. -benchtime=5s -benchmem bench_test.go
    32            env writeratio=0.01 zipfian=true go test -v -cpu=8 -run=none -bench=. -benchtime=5s -benchmem bench_test.go