aboutsummaryrefslogtreecommitdiff
path: root/lib/ascii/set_benchmark_test.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2026-04-05 03:50:32 +0700
committerShulhan <ms@kilabit.info>2026-04-05 03:52:47 +0700
commit778fd16011ec1d39c41b62372dc65f045183266e (patch)
treea6f6f26930c00d8ac3dd7bfa1fb476bd65454833 /lib/ascii/set_benchmark_test.go
parent6fba7b9ce3bcaf4225e5ab774a15ef7364ed1420 (diff)
downloadpakakeh.go-778fd16011ec1d39c41b62372dc65f045183266e.tar.xz
all: apply go fix
Diffstat (limited to 'lib/ascii/set_benchmark_test.go')
-rw-r--r--lib/ascii/set_benchmark_test.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/ascii/set_benchmark_test.go b/lib/ascii/set_benchmark_test.go
index 53194daa..030ef82d 100644
--- a/lib/ascii/set_benchmark_test.go
+++ b/lib/ascii/set_benchmark_test.go
@@ -22,7 +22,7 @@ const N int = 10
// if populate is true, fill each set with every 2nd ASCII character
func setupSets(populate bool) []Set {
sets := []Set{}
- for i := 0; i < N; i++ {
+ for range N {
var as Set
if populate {
for c := 0; c < utf8.RuneSelf; c += 2 {
@@ -41,7 +41,7 @@ func setupSets(populate bool) []Set {
// if populate is true, fill each set with every 2nd ASCII character
func setupMapSets(populate bool) []map[byte]struct{} {
sets := []map[byte]struct{}{}
- for i := 0; i < N; i++ {
+ for range N {
as := make(map[byte]struct{})
if populate {
for c := 0; c < utf8.RuneSelf; c += 2 {
@@ -73,7 +73,7 @@ func BenchmarkSet(b *testing.B) {
b.ResetTimer()
for i := 0; i < b.N; i++ {
for _, as := range sets {
- for c := byte(0); c < utf8.RuneSelf; c++ {
+ for c := range byte(utf8.RuneSelf) {
exists = as.Contains(c)
}
}
@@ -85,7 +85,7 @@ func BenchmarkSet(b *testing.B) {
b.ResetTimer()
for i := 0; i < b.N; i++ {
for _, as := range sets {
- for c := byte(0); c < utf8.RuneSelf; c++ {
+ for c := range byte(utf8.RuneSelf) {
as.Remove(c)
}
}
@@ -97,7 +97,7 @@ func BenchmarkSet(b *testing.B) {
b.ResetTimer()
for i := 0; i < b.N; i++ {
for _, as := range sets {
- for c := byte(0); c < utf8.RuneSelf; c++ {
+ for range byte(utf8.RuneSelf) {
size = as.Size()
}
}
@@ -139,7 +139,7 @@ func BenchmarkMapSet(b *testing.B) {
b.ResetTimer()
for i := 0; i < b.N; i++ {
for _, as := range sets {
- for c := byte(0); c < utf8.RuneSelf; c++ {
+ for c := range byte(utf8.RuneSelf) {
_, exists = as[c]
}
}
@@ -151,7 +151,7 @@ func BenchmarkMapSet(b *testing.B) {
b.ResetTimer()
for i := 0; i < b.N; i++ {
for _, as := range sets {
- for c := byte(0); c < utf8.RuneSelf; c++ {
+ for c := range byte(utf8.RuneSelf) {
delete(as, c)
}
}
@@ -163,7 +163,7 @@ func BenchmarkMapSet(b *testing.B) {
b.ResetTimer()
for i := 0; i < b.N; i++ {
for _, as := range sets {
- for c := byte(0); c < utf8.RuneSelf; c++ {
+ for range byte(utf8.RuneSelf) {
size = len(as)
}
}