MCPcopy
hub / github.com/tdewolff/canvas / BenchmarkScanner

Function BenchmarkScanner

path_scanner_test.go:5–23  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

3import "testing"
4
5func BenchmarkScanner(b *testing.B) {
6 p := RandomPath(1000, true)
7 b.Run("Manual", func(b *testing.B) {
8 for i := 0; i < b.N; i++ {
9 for j := 0; j < len(p.d); {
10 j += cmdLen(p.d[j])
11 _, _ = p.d[j-3], p.d[j-2]
12 }
13 }
14 })
15
16 b.Run("Scanner", func(b *testing.B) {
17 for i := 0; i < b.N; i++ {
18 for s := p.Scanner(); s.Scan(); {
19 _ = s.End()
20 }
21 }
22 })
23}

Callers

nothing calls this directly

Calls 6

RandomPathFunction · 0.85
cmdLenFunction · 0.85
ScannerMethod · 0.80
RunMethod · 0.45
ScanMethod · 0.45
EndMethod · 0.45

Tested by

no test coverage detected