github.com/goshafaq/sonic@v0.0.0-20231026082336-871835fb94c6/scripts/bench.sh (about) 1 #!/usr/bin/env bash 2 3 pwd=$(pwd) 4 export SONIC_NO_ASYNC_GC=1 5 6 cd $pwd/encoder 7 go test -benchmem -run=^$ -benchtime=100000x -bench "^(BenchmarkEncoder_.*)$" 8 9 cd $pwd/decoder 10 go test -benchmem -run=^$ -benchtime=100000x -bench "^(BenchmarkDecoder_.*)$" 11 12 cd $pwd/ast 13 go test -benchmem -run=^$ -benchtime=1000000x -bench "^(BenchmarkGet.*|BenchmarkSet.*)$" 14 15 go test -benchmem -run=^$ -benchtime=10000x -bench "^(BenchmarkParser_.*|BenchmarkEncode.*)$" 16 17 go test -benchmem -run=^$ -benchtime=10000000x -bench "^(BenchmarkNodeGetByPath|BenchmarkStructGetByPath|BenchmarkNodeIndex|BenchmarkStructIndex|BenchmarkSliceIndex|BenchmarkMapIndex|BenchmarkNodeGet|BenchmarkSliceGet|BenchmarkMapGet|BenchmarkNodeSet|BenchmarkMapSet|BenchmarkNodeSetByIndex|BenchmarkSliceSetByIndex|BenchmarkStructSetByIndex|BenchmarkNodeUnset|BenchmarkMapUnset|BenchmarkNodUnsetByIndex|BenchmarkSliceUnsetByIndex|BenchmarkNodeAdd|BenchmarkSliceAdd|BenchmarkMapAdd)$" 18 19 cd $pwd/external_jsonlib_test/benchmark_test 20 go test -benchmem -run=^$ -benchtime=100000x -bench "^(BenchmarkEncoder_.*|BenchmarkDecoder_.*)$" 21 22 go test -benchmem -run=^$ -benchtime=1000000x -bench "^(BenchmarkGet.*|BenchmarkSet.*)$" 23 24 go test -benchmem -run=^$ -benchtime=10000x -bench "^(BenchmarkParser_.*)$" 25 26 unset SONIC_NO_ASYNC_GC 27 cd $pwd