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

Function BenchmarkSlice

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

Source from the content-addressed store, hash-verified

36}
37
38func BenchmarkSlice(b *testing.B) {
39 b.StopTimer()
40 sel := DocB().Find("dd")
41 j := 0
42 b.StartTimer()
43 for i := 0; i < b.N; i++ {
44 sel.Slice(j, j+4)
45 if j++; j >= (sel.Length() - 4) {
46 j = 0
47 }
48 }
49}
50
51func BenchmarkGet(b *testing.B) {
52 b.StopTimer()

Callers

nothing calls this directly

Calls 4

DocBFunction · 0.85
FindMethod · 0.80
SliceMethod · 0.80
LengthMethod · 0.80

Tested by

no test coverage detected