github.com/phuslu/lru@v1.0.16-0.20240421170520-46288a2fd47c/.github/workflows/memory.yml (about) 1 name: memory 2 3 on: 4 schedule: 5 - cron: '0 0 * * *' 6 push: 7 branches: 8 - master 9 10 jobs: 11 memory: 12 runs-on: ubuntu-latest 13 steps: 14 - name: Install packages 15 run: sudo apt update -y && sudo apt-get install -y csvkit datamash 16 - uses: actions/setup-go@v4 17 with: 18 go-version: '1.22' 19 check-latest: true 20 - uses: actions/checkout@v4 21 - name: go mod tidy 22 run: | 23 mkdir bench 24 cd bench 25 awk '{if($0 ~ "// memusage.go"){a=1;b=1};if($0 ~ "```" && b=1){b=0};if (a&&b) {print}}' ../README.md > memusage.go 26 go mod init bench 27 go mod tidy 28 go mod edit -replace github.com/phuslu/lru=../ 29 cat go.mod 30 - name: Memory Tests 31 working-directory: ./bench 32 run: | 33 echo -e 'MemStats\tCacheSize\tAlloc\tTotalAlloc\tSys' > memusage.txt 34 for name in nottl phuslu lxzan ristretto freelru ecache otter theine cloudflare ccache hashicorp; do 35 for cachesize in 100000 200000 400000 1000000 2000000 4000000; do 36 go run memusage.go $name $cachesize >> memusage.txt 37 done 38 done 39 cat memusage.txt 40 - name: Memory Results 41 working-directory: ./bench 42 run: | 43 cat memusage.txt | datamash --header-in crosstab 1,2 unique 3 | tee >(head -1) | tail -n +2 | sort -k12 -n | datamash transpose | tee >(head -1) | tail -n +2 | sort -n | datamash transpose | csvlook