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

Function BenchmarkNextUntilSelection

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

Source from the content-addressed store, hash-verified

538}
539
540func BenchmarkNextUntilSelection(b *testing.B) {
541 var n int
542
543 b.StopTimer()
544 sel := DocW().Find("h2")
545 sel2 := DocW().Find("ul")
546 b.StartTimer()
547 for i := 0; i < b.N; i++ {
548 if n == 0 {
549 n = sel.NextUntilSelection(sel2).Length()
550 } else {
551 sel.NextUntilSelection(sel2)
552 }
553 }
554 if n != 42 {
555 b.Fatalf("want 42, got %d", n)
556 }
557}
558
559func BenchmarkNextUntilNodes(b *testing.B) {
560 var n int

Callers

nothing calls this directly

Calls 4

DocWFunction · 0.85
FindMethod · 0.80
LengthMethod · 0.80
NextUntilSelectionMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…