MCPcopy Create free account
hub / github.com/PuerkitoBio/goquery / BenchmarkIndexOfNode

Function BenchmarkIndexOfNode

bench_array_test.go:92–106  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

90}
91
92func BenchmarkIndexOfNode(b *testing.B) {
93 var j int
94
95 b.StopTimer()
96 sel := DocB().Find("span a")
97 sel2 := DocB().Find("span a:nth-child(3)")
98 n := sel2.Get(0)
99 b.StartTimer()
100 for i := 0; i < b.N; i++ {
101 j = sel.IndexOfNode(n)
102 }
103 if j != 2 {
104 b.Fatalf("want 2, got %d", j)
105 }
106}
107
108func BenchmarkIndexOfSelection(b *testing.B) {
109 var j int

Callers

nothing calls this directly

Calls 4

DocBFunction · 0.85
FindMethod · 0.80
GetMethod · 0.80
IndexOfNodeMethod · 0.80

Tested by

no test coverage detected