Skip to content

add memory usage tests #120

add memory usage tests

add memory usage tests #120

Workflow file for this run

name: benchmark
on:
schedule:
- cron: '0 0 * * *'
push:
branches:
- master
jobs:
benchmark:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v4
with:
go-version: '1.21'
check-latest: true
- uses: actions/checkout@v4
- name: go mod tidy
run: |
mkdir bench
cd bench
awk '{if($0 ~ "// go test -v"){a=1;b=1};if($0 ~ "```" && b=1){b=0};if (a&&b) {print}}' ../README.md | tee bench_test.go
go mod tidy
go mod edit -replace github.com/phuslu/lru=../
- name: Tests
run: |
go test -v -bench=. -race -count=1 -coverprofile=coverage.txt
- name: Benchmark
working-directory: ./bench
run: |
go test -v -cpu=8 -run=none -bench=. -benchtime=5s -benchmem bench_test.go
- name: Memory Usage
working-directory: ./bench
run: |
awk '{if($0 ~ "// memusage.go"){a=1;b=1};if($0 ~ "```" && b=1){b=0};if (a&&b) {print}}' ../README.md | tee memusage.go
go run memusage.go phuslu
go run memusage.go theine
go run memusage.go cloudflare
go run memusage.go ristretto
go run memusage.go otter
go run memusage.go ecache
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}