From 8c0f66cf3853cf58410fa71b118c65cdbf72859b Mon Sep 17 00:00:00 2001 From: "duanyi.aster" Date: Wed, 8 Jun 2022 15:38:31 +0800 Subject: [PATCH] test: add Diff on CI --- .github/workflows/benchmark-linux-amd64.yml | 5 ++++- ast/encode_test.go | 6 +++--- bench.py | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/benchmark-linux-amd64.yml b/.github/workflows/benchmark-linux-amd64.yml index 199fa3a1f..c11c31aeb 100644 --- a/.github/workflows/benchmark-linux-amd64.yml +++ b/.github/workflows/benchmark-linux-amd64.yml @@ -4,7 +4,7 @@ on: pull_request jobs: build: - runs-on: self-hosted + runs-on: [self-hosted, X64] steps: - uses: actions/checkout@v2 @@ -25,3 +25,6 @@ jobs: - name: Benchmark run: sh bench.sh + + - name: Diff + run: ./bench.py -b '"^Benchmark.*Sonic"' -c diff --git a/ast/encode_test.go b/ast/encode_test.go index 31faa29c3..677bd577b 100644 --- a/ast/encode_test.go +++ b/ast/encode_test.go @@ -144,7 +144,7 @@ func TestEncodeNode(t *testing.T) { } } -func BenchmarkEncodeRaw(b *testing.B) { +func BenchmarkEncodeRaw_Sonic(b *testing.B) { data := _TwitterJson root, e := NewSearcher(data).GetByPath() if e != nil { @@ -164,7 +164,7 @@ func BenchmarkEncodeRaw(b *testing.B) { } } -func BenchmarkEncodeSkip(b *testing.B) { +func BenchmarkEncodeSkip_Sonic(b *testing.B) { data := _TwitterJson root, e := NewParser(data).Parse() if e != 0 { @@ -185,7 +185,7 @@ func BenchmarkEncodeSkip(b *testing.B) { } } -func BenchmarkEncodeLoad(b *testing.B) { +func BenchmarkEncodeLoad_Sonic(b *testing.B) { data := _TwitterJson root, e := NewParser(data).Parse() if e != 0 { diff --git a/bench.py b/bench.py index 024494144..1ea35d443 100755 --- a/bench.py +++ b/bench.py @@ -70,7 +70,7 @@ def compare(args): run("git checkout -- .") if current_branch != "main": run("git checkout main") - run("git pull origin main") + run("git pull --allow-unrelated-histories origin main") # benchmark main branch (fd, main) = tempfile.mkstemp(".main.txt")