MCPcopy
hub / github.com/PuerkitoBio/goquery / BenchmarkFindNodes

Function BenchmarkFindNodes

bench_traversal_test.go:62–80  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

60}
61
62func BenchmarkFindNodes(b *testing.B) {
63 var n int
64
65 b.StopTimer()
66 sel := DocW().Find("ul")
67 sel2 := DocW().Find("span")
68 nodes := sel2.Nodes
69 b.StartTimer()
70 for i := 0; i < b.N; i++ {
71 if n == 0 {
72 n = sel.FindNodes(nodes...).Length()
73 } else {
74 sel.FindNodes(nodes...)
75 }
76 }
77 if n != 73 {
78 b.Fatalf("want 73, got %d", n)
79 }
80}
81
82func BenchmarkContents(b *testing.B) {
83 var n int

Callers

nothing calls this directly

Calls 4

DocWFunction · 0.85
FindMethod · 0.80
LengthMethod · 0.80
FindNodesMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…