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

Function BenchmarkContents

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

Source from the content-addressed store, hash-verified

80}
81
82func BenchmarkContents(b *testing.B) {
83 var n int
84
85 b.StopTimer()
86 sel := DocW().Find(".toclevel-1")
87 b.StartTimer()
88 for i := 0; i < b.N; i++ {
89 if n == 0 {
90 n = sel.Contents().Length()
91 } else {
92 sel.Contents()
93 }
94 }
95 if n != 16 {
96 b.Fatalf("want 16, got %d", n)
97 }
98}
99
100func BenchmarkContentsFiltered(b *testing.B) {
101 var n int

Callers

nothing calls this directly

Calls 4

DocWFunction · 0.85
FindMethod · 0.80
LengthMethod · 0.80
ContentsMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…