Skip to content

Commit

Permalink
fix benchmark code
Browse files Browse the repository at this point in the history
  • Loading branch information
mattn committed Jul 22, 2024
1 parent 6ceadc6 commit 239943a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 4 additions & 6 deletions benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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++ {
Expand Down

0 comments on commit 239943a

Please sign in to comment.