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

Function BenchmarkFindWithinSelection

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

Source from the content-addressed store, hash-verified

23}
24
25func BenchmarkFindWithinSelection(b *testing.B) {
26 var n int
27
28 b.StopTimer()
29 sel := DocW().Find("ul")
30 b.StartTimer()
31 for i := 0; i < b.N; i++ {
32 if n == 0 {
33 n = sel.Find("a[class]").Length()
34 } else {
35 sel.Find("a[class]")
36 }
37 }
38 if n != 39 {
39 b.Fatalf("want 39, got %d", n)
40 }
41}
42
43func BenchmarkFindSelection(b *testing.B) {
44 var n int

Callers

nothing calls this directly

Calls 3

DocWFunction · 0.85
FindMethod · 0.80
LengthMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…