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

Function BenchmarkChildren

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

Source from the content-addressed store, hash-verified

116}
117
118func BenchmarkChildren(b *testing.B) {
119 var n int
120
121 b.StopTimer()
122 sel := DocW().Find(".toclevel-2")
123 b.StartTimer()
124 for i := 0; i < b.N; i++ {
125 if n == 0 {
126 n = sel.Children().Length()
127 } else {
128 sel.Children()
129 }
130 }
131 if n != 2 {
132 b.Fatalf("want 2, got %d", n)
133 }
134}
135
136func BenchmarkChildrenFiltered(b *testing.B) {
137 var n int

Callers

nothing calls this directly

Calls 4

DocWFunction · 0.85
FindMethod · 0.80
LengthMethod · 0.80
ChildrenMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…