golang.org/x/tools@v0.21.0/internal/fuzzy/self_test.go (about) 1 // Copyright 2023 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package fuzzy_test 6 7 import ( 8 "testing" 9 10 . "golang.org/x/tools/internal/fuzzy" 11 ) 12 13 func BenchmarkSelf_Matcher(b *testing.B) { 14 idents := collectIdentifiers(b) 15 patterns := generatePatterns() 16 17 for i := 0; i < b.N; i++ { 18 for _, pattern := range patterns { 19 sm := NewMatcher(pattern) 20 for _, ident := range idents { 21 _ = sm.Score(ident) 22 } 23 } 24 } 25 } 26 27 func BenchmarkSelf_SymbolMatcher(b *testing.B) { 28 idents := collectIdentifiers(b) 29 patterns := generatePatterns() 30 31 for i := 0; i < b.N; i++ { 32 for _, pattern := range patterns { 33 sm := NewSymbolMatcher(pattern) 34 for _, ident := range idents { 35 _, _ = sm.Match([]string{ident}) 36 } 37 } 38 } 39 }