Debian Codegraph @

simd/bench_test.go

raw symbols SCIP
1 package simdscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/
2
3 import (
4 "bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/"
5 "strconvscip-go gomod github.com/golang/go/src go1.25.0 strconv/"
6 "testingscip-go gomod github.com/golang/go/src go1.25.0 testing/"
7 )
8
9 // The benchmarks pair each function with the closest idiomatic alternative
10 // (stdlib where one exists, a scalar loop otherwise) using the
11 // fiber-vs-default sub-run naming shared with the other packages. Inputs are
12 // worst-case misses so every variant scans the full haystack.
13
14 var benchSizesscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/benchSizes. = []int{8, 32, 64, 512, 4096}
15
16 func benchNamescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/benchName().(n int) string {
17 return strconvscip-go gomod github.com/golang/go/src go1.25.0 strconv/.Itoascip-go gomod github.com/golang/go/src go1.25.0 strconv/Itoa().(n) + "B"
18 }
19
20 // benchData is 'a'..'w' repeating: pure ASCII, no digits, no match for the
21 // searched needles below.
22 func benchDatascip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/benchData().(n int) []byte {
23 b := make([]byte, n)
24 for i := range b {
25 b[i] = 'a' + byte(i%23)
26 }
27 return b
28 }
29
30 func Benchmark_Memchr2scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/Benchmark_Memchr2().(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) {
31 for _, n := range benchSizesscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/benchSizes. {
32 data := benchDatascip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/benchData().(n)
33 b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().(benchNamescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/benchName().(n)+"/simd", func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) {
34 b.ReportAllocsscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ReportAllocs().()
35 for range b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N. {
36 if Memchr2scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/Memchr2().(data, 'z', 'y') != -1 {
37 b.Fatalscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatal().("unexpected match")
38 }
39 }
40 })
41 b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().(benchNamescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/benchName().(n)+"/scalar", func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) {
42 b.ReportAllocsscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ReportAllocs().()
43 for range b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N. {
44 if memchr2Genericscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/memchr2Generic().(data, 'z', 'y') != -1 {
45 b.Fatalscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatal().("unexpected match")
46 }
47 }
48 })
49 b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().(benchNamescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/benchName().(n)+"/default", func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) {
50 b.ReportAllocsscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ReportAllocs().()
51 for range b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N. {
52 if bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/.ContainsAnyscip-go gomod github.com/golang/go/src go1.25.0 bytes/ContainsAny().(data, "zy") {
53 b.Fatalscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatal().("unexpected match")
54 }
55 }
56 })
57 }
58 }
59
60 func Benchmark_Memchr3scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/Benchmark_Memchr3().(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) {
61 for _, n := range benchSizesscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/benchSizes. {
62 data := benchDatascip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/benchData().(n)
63 b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().(benchNamescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/benchName().(n)+"/simd", func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) {
64 b.ReportAllocsscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ReportAllocs().()
65 for range b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N. {
66 if Memchr3scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/Memchr3().(data, 'z', 'y', 'x') != -1 {
67 b.Fatalscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatal().("unexpected match")
68 }
69 }
70 })
71 b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().(benchNamescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/benchName().(n)+"/scalar", func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) {
72 b.ReportAllocsscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ReportAllocs().()
73 for range b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N. {
74 if memchr3Genericscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/memchr3Generic().(data, 'z', 'y', 'x') != -1 {
75 b.Fatalscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatal().("unexpected match")
76 }
77 }
78 })
79 b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().(benchNamescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/benchName().(n)+"/default", func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) {
80 b.ReportAllocsscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ReportAllocs().()
81 for range b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N. {
82 if bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/.ContainsAnyscip-go gomod github.com/golang/go/src go1.25.0 bytes/ContainsAny().(data, "zyx") {
83 b.Fatalscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatal().("unexpected match")
84 }
85 }
86 })
87 }
88 }
89
90 func Benchmark_MemchrPairscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/Benchmark_MemchrPair().(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) {
91 for _, n := range benchSizesscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/benchSizes. {
92 data := benchDatascip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/benchData().(n)
93 b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().(benchNamescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/benchName().(n)+"/simd", func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) {
94 b.ReportAllocsscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ReportAllocs().()
95 for range b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N. {
96 if MemchrPairscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/MemchrPair().(data, 'a', 'c', 1) != -1 {
97 b.Fatalscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatal().("unexpected match")
98 }
99 }
100 })
101 b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().(benchNamescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/benchName().(n)+"/scalar", func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) {
102 b.ReportAllocsscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ReportAllocs().()
103 for range b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N. {
104 if refMemchrPairscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/refMemchrPair().(data, 'a', 'c', 1) != -1 {
105 b.Fatalscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatal().("unexpected match")
106 }
107 }
108 })
109 }
110 }
111
112 func Benchmark_MemchrDigitscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/Benchmark_MemchrDigit().(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) {
113 for _, n := range benchSizesscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/benchSizes. {
114 data := benchDatascip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/benchData().(n)
115 b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().(benchNamescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/benchName().(n)+"/simd", func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) {
116 b.ReportAllocsscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ReportAllocs().()
117 for range b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N. {
118 if MemchrDigitscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/MemchrDigit().(data) != -1 {
119 b.Fatalscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatal().("unexpected match")
120 }
121 }
122 })
123 b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().(benchNamescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/benchName().(n)+"/scalar", func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) {
124 b.ReportAllocsscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ReportAllocs().()
125 for range b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N. {
126 if memchrDigitGenericscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/memchrDigitGeneric().(data) != -1 {
127 b.Fatalscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatal().("unexpected match")
128 }
129 }
130 })
131 }
132 }
133
134 // benchNonWordData is a repeating run of punctuation and spaces holding no
135 // \w character, so MemchrWord has to scan the whole haystack. benchData
136 // cannot serve here: its first byte is already a word character.
137 func benchNonWordDatascip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/benchNonWordData().(n int) []byte {
138 const punct = "!\"#$%&'()*+,-./:;<=>?@[\\]^`{|}~ "
139 b := make([]byte, n)
140 for i := range b {
141 b[i] = punct[i%len(punct)]
142 }
143 return b
144 }
145
146 func Benchmark_MemchrWordscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/Benchmark_MemchrWord().(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) {
147 for _, n := range benchSizesscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/benchSizes. {
148 data := benchNonWordDatascip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/benchNonWordData().(n)
149 b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().(benchNamescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/benchName().(n)+"/simd", func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) {
150 b.ReportAllocsscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ReportAllocs().()
151 for range b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N. {
152 if MemchrWordscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/MemchrWord().(data) != -1 {
153 b.Fatalscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatal().("unexpected match")
154 }
155 }
156 })
157 b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().(benchNamescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/benchName().(n)+"/scalar", func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) {
158 b.ReportAllocsscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ReportAllocs().()
159 for range b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N. {
160 if memchrWordGenericscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/memchrWordGeneric().(data) != -1 {
161 b.Fatalscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatal().("unexpected match")
162 }
163 }
164 })
165 }
166 }
167
168 func Benchmark_MemchrNotWordscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/Benchmark_MemchrNotWord().(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) {
169 for _, n := range benchSizesscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/benchSizes. {
170 data := benchDatascip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/benchData().(n)
171 b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().(benchNamescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/benchName().(n)+"/simd", func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) {
172 b.ReportAllocsscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ReportAllocs().()
173 for range b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N. {
174 if MemchrNotWordscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/MemchrNotWord().(data) != -1 {
175 b.Fatalscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatal().("unexpected match")
176 }
177 }
178 })
179 b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().(benchNamescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/benchName().(n)+"/scalar", func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) {
180 b.ReportAllocsscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ReportAllocs().()
181 for range b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N. {
182 if memchrNotWordGenericscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/memchrNotWordGeneric().(data) != -1 {
183 b.Fatalscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatal().("unexpected match")
184 }
185 }
186 })
187 }
188 }
189
190 // memmemBenchSizes brackets the 128-byte crossover that memmemMinHaystack
191 // encodes. Benchmark_Memmem measures the exported routing end to end — its
192 // sub-128B simd rows run bytes.Index plus dispatch, so they show routing
193 // overhead only — while Benchmark_Memmem_Prefilter forces the prefilter
194 // helpers at every size, making the crossover itself reproducible from
195 // this file.
196 var memmemBenchSizesscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/memmemBenchSizes. = []int{8, 32, 64, 96, 128, 192, 512, 4096}
197
198 func Benchmark_Memmemscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/Benchmark_Memmem().(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) {
199 needle := []byte("q7z")
200 for _, n := range memmemBenchSizesscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/memmemBenchSizes. {
201 data := benchDatascip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/benchData().(n)
202 b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().(benchNamescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/benchName().(n)+"/simd", func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) {
203 b.ReportAllocsscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ReportAllocs().()
204 for range b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N. {
205 if Memmemscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/Memmem().(data, needle) != -1 {
206 b.Fatalscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatal().("unexpected match")
207 }
208 }
209 })
210 b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().(benchNamescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/benchName().(n)+"/default", func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) {
211 b.ReportAllocsscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ReportAllocs().()
212 for range b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N. {
213 if bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/.Containsscip-go gomod github.com/golang/go/src go1.25.0 bytes/Contains().(data, needle) {
214 b.Fatalscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatal().("unexpected match")
215 }
216 }
217 })
218 }
219 }
220
221 // Benchmark_Memmem_Prefilter drives the prefilter helpers directly,
222 // bypassing Memmem's 128-byte routing, so the memmemMinHaystack tradeoff
223 // is measurable instead of asserted. Each helper gets the needle shape
224 // Memmem actually routes to it: the paired scan (short needle, two
225 // distinct rare bytes) breaks even with bytes.Index around the 64B point
226 // and wins from 96B up, so 128 carries a conservative margin that also
227 // covers the per-call SelectRareBytes cost these direct calls exclude.
228 // The single scan (long needle) anchors on 'q', which benchData's
229 // repeating 'a'..'w' cycle yields every 23 bytes, so from a few hundred
230 // bytes up it burns its miss budget and lands on the fallback, tracking
231 // bytes.Index within a constant — the documented bounded worst case; its
232 // wins come on data where the anchor byte is genuinely rare.
233 func Benchmark_Memmem_Prefilterscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/Benchmark_Memmem_Prefilter().(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) {
234 pairNeedle := []byte("q7z")
235 pairInfo := SelectRareBytesscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/SelectRareBytes().(pairNeedle)
236 singleNeedle := []byte("the quick brown fox")
237 singleInfo := SelectRareBytesscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/SelectRareBytes().(singleNeedle)
238 for _, n := range memmemBenchSizesscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/memmemBenchSizes. {
239 data := benchDatascip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/benchData().(n)
240 b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().(benchNamescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/benchName().(n)+"/paired", func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) {
241 b.ReportAllocsscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ReportAllocs().()
242 for range b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N. {
243 if memmemPairedscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/memmemPaired().(data, pairNeedle, pairInfo) != -1 {
244 b.Fatalscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatal().("unexpected match")
245 }
246 }
247 })
248 b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().(benchNamescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/benchName().(n)+"/paired-stdlib", func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) {
249 b.ReportAllocsscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ReportAllocs().()
250 for range b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N. {
251 if bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/.Containsscip-go gomod github.com/golang/go/src go1.25.0 bytes/Contains().(data, pairNeedle) {
252 b.Fatalscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatal().("unexpected match")
253 }
254 }
255 })
256 if n < len(singleNeedle) {
257 continue
258 }
259 b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().(benchNamescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/benchName().(n)+"/single", func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) {
260 b.ReportAllocsscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ReportAllocs().()
261 for range b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N. {
262 if memmemSinglescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/memmemSingle().(data, singleNeedle, singleInfo.Byte1scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/RareByteInfo#Byte1., singleInfo.Index1scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/RareByteInfo#Index1.) != -1 {
263 b.Fatalscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatal().("unexpected match")
264 }
265 }
266 })
267 b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().(benchNamescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/benchName().(n)+"/single-stdlib", func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) {
268 b.ReportAllocsscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ReportAllocs().()
269 for range b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N. {
270 if bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/.Containsscip-go gomod github.com/golang/go/src go1.25.0 bytes/Contains().(data, singleNeedle) {
271 b.Fatalscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatal().("unexpected match")
272 }
273 }
274 })
275 }
276 }
277
278 // Benchmark_Memmem_Adversarial pins the miss-budget fallback: every
279 // haystack position is a rare-byte anchor and the needle mismatches only at
280 // its last byte, the shape that used to degrade to O(n*m). With the budget
281 // it must track bytes.Index within a constant.
282 func Benchmark_Memmem_Adversarialscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/Benchmark_Memmem_Adversarial().(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) {
283 // The mismatch byte must rank as more common than 'z' so the rare-byte
284 // selection anchors on 'z' and every haystack position is a candidate.
285 haystack := bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/.Repeatscip-go gomod github.com/golang/go/src go1.25.0 bytes/Repeat().([]byte{'z'}, 1<<20)
286 needle := append(bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/.Repeatscip-go gomod github.com/golang/go/src go1.25.0 bytes/Repeat().([]byte{'z'}, 999), 'e')
287 b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().("simd", func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) {
288 b.ReportAllocsscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ReportAllocs().()
289 for range b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N. {
290 if Memmemscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/Memmem().(haystack, needle) != -1 {
291 b.Fatalscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatal().("unexpected match")
292 }
293 }
294 })
295 b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().("default", func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) {
296 b.ReportAllocsscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ReportAllocs().()
297 for range b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N. {
298 if bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/.Containsscip-go gomod github.com/golang/go/src go1.25.0 bytes/Contains().(haystack, needle) {
299 b.Fatalscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatal().("unexpected match")
300 }
301 }
302 })
303 }
304
305 func Benchmark_IsASCIIscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/Benchmark_IsASCII().(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) {
306 for _, n := range benchSizesscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/benchSizes. {
307 data := benchDatascip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/benchData().(n)
308 b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().(benchNamescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/benchName().(n)+"/simd", func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) {
309 b.ReportAllocsscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ReportAllocs().()
310 for range b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N. {
311 if !IsASCIIscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/IsASCII().(data) {
312 b.Fatalscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatal().("unexpected non-ASCII")
313 }
314 }
315 })
316 b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().(benchNamescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/benchName().(n)+"/swar", func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) {
317 b.ReportAllocsscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ReportAllocs().()
318 for range b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N. {
319 if !isASCIIGenericscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/isASCIIGeneric().(data) {
320 b.Fatalscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatal().("unexpected non-ASCII")
321 }
322 }
323 })
324 }
325 }
326
327 func Benchmark_FirstNonASCIIscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/Benchmark_FirstNonASCII().(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) {
328 for _, n := range benchSizesscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/benchSizes. {
329 data := benchDatascip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/benchData().(n)
330 b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().(benchNamescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/benchName().(n)+"/simd", func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) {
331 b.ReportAllocsscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ReportAllocs().()
332 for range b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N. {
333 if FirstNonASCIIscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/FirstNonASCII().(data) != -1 {
334 b.Fatalscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatal().("unexpected non-ASCII")
335 }
336 }
337 })
338 b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().(benchNamescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/benchName().(n)+"/swar", func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) {
339 b.ReportAllocsscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ReportAllocs().()
340 for range b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N. {
341 if firstNonASCIIGenericscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/firstNonASCIIGeneric().(data) != -1 {
342 b.Fatalscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatal().("unexpected non-ASCII")
343 }
344 }
345 })
346 }
347 }
348
349 func Benchmark_CountNonASCIIscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/Benchmark_CountNonASCII().(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) {
350 for _, n := range benchSizesscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/benchSizes. {
351 data := benchDatascip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/benchData().(n)
352 b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().(benchNamescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/benchName().(n)+"/simd", func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) {
353 b.ReportAllocsscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ReportAllocs().()
354 for range b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N. {
355 if CountNonASCIIscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/CountNonASCII().(data) != 0 {
356 b.Fatalscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatal().("unexpected non-ASCII")
357 }
358 }
359 })
360 b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().(benchNamescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/benchName().(n)+"/swar", func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) {
361 b.ReportAllocsscip-go gomod github.com/golang/go/src go1.25.0 testing/B#ReportAllocs().()
362 for range b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N. {
363 if countNonASCIIGenericscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/countNonASCIIGeneric().(data) != 0 {
364 b.Fatalscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatal().("unexpected non-ASCII")
365 }
366 }
367 })
368 }
369 }