Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix benchmark code #81

Merged
merged 1 commit into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading