MCPcopy Index your code
hub / github.com/TheAlgorithms/Go / BenchmarkTrie_Find_existent

Function BenchmarkTrie_Find_existent

structure/trie/trie_bench_test.go:40–52  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

38}
39
40func BenchmarkTrie_Find_existent(b *testing.B) {
41 insert := make([]string, 3000)
42 for i := 0; i < len(insert); i++ {
43 insert[i] = fmt.Sprintf("%f", rand.Float64())
44 }
45 n := NewNode()
46 n.Insert(insert...)
47
48 b.ResetTimer()
49 for i := 0; i < b.N; i++ {
50 n.Find(insert[i%3000]) // always exists !
51 }
52}
53
54func BenchmarkTrie_Remove_lazy(b *testing.B) {
55 insert := make([]string, 3000)

Callers

nothing calls this directly

Calls 3

InsertMethod · 0.95
FindMethod · 0.95
NewNodeFunction · 0.70

Tested by

no test coverage detected