From 239943a47853eda95deec41ad716b707f5e5a3e8 Mon Sep 17 00:00:00 2001 From: Yasuhiro Matsumoto Date: Mon, 22 Jul 2024 21:44:19 +0900 Subject: [PATCH] fix benchmark code --- .github/workflows/test.yaml | 9 ++++----- benchmark_test.go | 10 ++++------ 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 46d2dfd..f20144b 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -12,12 +12,11 @@ jobs: matrix: os: [windows-latest, macos-latest, ubuntu-latest] go: - - "1.15" - - "1.16" - - "1.17" - - "1.18" - - "1.19" + - "1.22" + - "1.21" - "1.20" + - "1.19" + - "1.18" runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 diff --git a/benchmark_test.go b/benchmark_test.go index 2f8ea06..c31db59 100644 --- a/benchmark_test.go +++ b/benchmark_test.go @@ -53,13 +53,13 @@ func benchRuneWidth(b *testing.B, eastAsianWidth bool, start, stop rune, want in return n } func BenchmarkRuneWidthAll(b *testing.B) { - benchSink = benchRuneWidth(b, false, 0, utf8.MaxRune+1, 1293942) + benchSink = benchRuneWidth(b, false, 0, utf8.MaxRune+1, 1293933) } func BenchmarkRuneWidth768(b *testing.B) { benchSink = benchRuneWidth(b, false, 0, 0x300, 702) } func BenchmarkRuneWidthAllEastAsian(b *testing.B) { - benchSink = benchRuneWidth(b, true, 0, utf8.MaxRune+1, 1432568) + benchSink = benchRuneWidth(b, true, 0, utf8.MaxRune+1, 1432559) } func BenchmarkRuneWidth768EastAsian(b *testing.B) { benchSink = benchRuneWidth(b, true, 0, 0x300, 794) @@ -113,21 +113,19 @@ func benchString1Width(b *testing.B, eastAsianWidth bool, start, stop rune, want return n } func BenchmarkString1WidthAll(b *testing.B) { - benchSink = benchString1Width(b, false, 0, utf8.MaxRune+1, 1295990) + benchSink = benchString1Width(b, false, 0, utf8.MaxRune+1, 1295981) } func BenchmarkString1Width768(b *testing.B) { benchSink = benchString1Width(b, false, 0, 0x300, 702) } func BenchmarkString1WidthAllEastAsian(b *testing.B) { - benchSink = benchString1Width(b, true, 0, utf8.MaxRune+1, 1436664) + benchSink = benchString1Width(b, true, 0, utf8.MaxRune+1, 1436655) } func BenchmarkString1Width768EastAsian(b *testing.B) { benchSink = benchString1Width(b, true, 0, 0x300, 794) } -// // tables -// func benchTable(b *testing.B, tbl table) int { n := 0 for i := 0; i < b.N; i++ {