github.com/phuslu/lru@v1.0.16-0.20240421170520-46288a2fd47c/.github/workflows/gcscan.yml (about) 1 name: gcscan 2 3 on: 4 schedule: 5 - cron: '0 0 * * *' 6 push: 7 branches: 8 - master 9 10 jobs: 11 gcscan: 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 ~ "// env GODEBUG=gctrace=1"){a=1;b=1};if($0 ~ "```" && b=1){b=0};if (a&&b) {print}}' ../README.md > gcscan.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: GC Tests 31 working-directory: ./bench 32 run: | 33 echo -e 'GCScan\tCacheSize\tScanTime' > gcscan.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; do 36 env GODEBUG=gctrace=1 repeat=40 go run gcscan.go $name $cachesize 2>&1 | tee gcscan-$name-$cachesize.txt 37 echo -e "$name\t$cachesize\t$(grep ^gc gcscan-$name-$cachesize.txt | tail -30 | awk -F+ '{a+=$2}END{print int(a/30)}') ms" | tee -a gcscan.txt 38 done 39 done 40 cat gcscan.txt 41 - name: GC Results 42 working-directory: ./bench 43 run: | 44 cat gcscan.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