From d248f06ae60c34e3cb8407cea6d31bcd1d1c0941 Mon Sep 17 00:00:00 2001 From: "duanyi.aster" Date: Tue, 27 Aug 2024 16:46:18 +0800 Subject: [PATCH] ci --- .github/workflows/benchmark.yml | 12 ++++++------ decoder/decoder_native_test.go | 2 ++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 1d95c9769..f6306f9e5 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -29,9 +29,9 @@ jobs: - name: Benchmark Target run: | export SONIC_NO_ASYNC_GC=1 - go test -run ^$ -count=10 -benchtime=100000x -benchmem -bench 'BenchmarkDecoder_(Generic|Binding)_Sonic' ./decoder >> /var/tmp/sonic_bench_target.out - go test -run ^$ -count=10 -benchtime=200000x -benchmem -bench 'BenchmarkEncoder_(Generic|Binding)_Sonic' ./encoder >> /var/tmp/sonic_bench_target.out - go test -run ^$ -count=10 -benchtime=500000x -benchmem -bench 'Benchmark(Get|Set)One_Sonic|BenchmarkParseSeven_Sonic' ./ast >> /var/tmp/sonic_bench_target.out + go test -run ^$ -count=100 -benchtime=100000x -benchmem -bench 'BenchmarkDecoder_(Generic|Binding)_Sonic' ./decoder >> /var/tmp/sonic_bench_target.out + go test -run ^$ -count=100 -benchtime=200000x -benchmem -bench 'BenchmarkEncoder_(Generic|Binding)_Sonic' ./encoder >> /var/tmp/sonic_bench_target.out + go test -run ^$ -count=100 -benchtime=500000x -benchmem -bench 'Benchmark(Get|Set)One_Sonic|BenchmarkParseSeven_Sonic' ./ast >> /var/tmp/sonic_bench_target.out - name: Clear repository run: sudo rm -fr $GITHUB_WORKSPACE && mkdir $GITHUB_WORKSPACE @@ -44,9 +44,9 @@ jobs: - name: Benchmark main run: | export SONIC_NO_ASYNC_GC=1 - go test -run ^$ -count=10 -benchtime=100000x -benchmem -bench 'BenchmarkDecoder_(Generic|Binding)_Sonic' ./decoder >> /var/tmp/sonic_bench_main.out - go test -run ^$ -count=10 -benchtime=200000x -benchmem -bench 'BenchmarkEncoder_(Generic|Binding)_Sonic' ./encoder >> /var/tmp/sonic_bench_main.out - go test -run ^$ -count=10 -benchtime=500000x -benchmem -bench 'Benchmark(Get|Set)One_Sonic|BenchmarkParseSeven_Sonic' ./ast > /var/tmp/sonic_bench_main.out + go test -run ^$ -count=100 -benchtime=100000x -benchmem -bench 'BenchmarkDecoder_(Generic|Binding)_Sonic' ./decoder >> /var/tmp/sonic_bench_main.out + go test -run ^$ -count=100 -benchtime=200000x -benchmem -bench 'BenchmarkEncoder_(Generic|Binding)_Sonic' ./encoder >> /var/tmp/sonic_bench_main.out + go test -run ^$ -count=100 -benchtime=500000x -benchmem -bench 'Benchmark(Get|Set)One_Sonic|BenchmarkParseSeven_Sonic' ./ast > /var/tmp/sonic_bench_main.out - name: Diff bench run: | diff --git a/decoder/decoder_native_test.go b/decoder/decoder_native_test.go index d8dbcc7ad..9b435ca92 100644 --- a/decoder/decoder_native_test.go +++ b/decoder/decoder_native_test.go @@ -41,6 +41,7 @@ func BenchmarkSkipValidate(b *testing.B) { C [1]int `json:"c"` // fast int D struct {} `json:"d"` // empty struct E map[string]int `json:"e"` // mismatched elem + F json.RawMessage `json:"f"` // unmarshaler // Unknonwn } type C struct { @@ -64,6 +65,7 @@ func BenchmarkSkipValidate(b *testing.B) { {"unknown", `{"unknown":`+compt+`}`, 5}, {"empty", `{"d":`+compt+`}`, 5}, {"mismatched elem", `{"e":`+compt+`}`, 5}, + {"unmarshaler", `{"f":`+compt+`}`, 3}, } _ = NewDecoder(`{}`).Decode(&skiptype{})