MCPcopy Create free account
hub / github.com/dlclark/regexp2 / BenchmarkSplitUnicodePrefix

Function BenchmarkSplitUnicodePrefix

string_processing_benchmark_test.go:188–200  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

186}
187
188func BenchmarkSplitUnicodePrefix(b *testing.B) {
189 re := MustCompile(`(needle)`)
190 prefix := strings.Repeat("界", 21845)
191 input := prefix + "needle尾"
192 b.ReportAllocs()
193 b.ResetTimer()
194 for i := 0; i < b.N; i++ {
195 got, err := re.Split(input, -1)
196 if err != nil || len(got) != 3 || got[0] != prefix || got[1] != "needle" || got[2] != "尾" {
197 b.Fatal(got, err)
198 }
199 }
200}

Callers

nothing calls this directly

Calls 2

SplitMethod · 0.80
MustCompileFunction · 0.70

Tested by

no test coverage detected