MCPcopy
hub / github.com/golang/geo / BenchmarkRectDecode

Function BenchmarkRectDecode

s2/encode_test.go:340–356  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

338}
339
340func BenchmarkRectDecode(b *testing.B) {
341 rect := RectFromCenterSize(LatLngFromDegrees(80, 170), LatLngFromDegrees(40, 60))
342 var buf bytes.Buffer
343 if err := rect.Encode(&buf); err != nil {
344 b.Fatal(err)
345 }
346 encoded := buf.Bytes()
347 b.ReportAllocs()
348 b.SetBytes(int64(len(encoded)))
349 b.ResetTimer()
350 var out Rect
351 for i := 0; i < b.N; i++ {
352 if err := out.Decode(bytes.NewReader(encoded)); err != nil {
353 b.Fatal(err)
354 }
355 }
356}

Callers

nothing calls this directly

Calls 4

DecodeMethod · 0.95
LatLngFromDegreesFunction · 0.85
RectFromCenterSizeFunction · 0.70
EncodeMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…