MCPcopy
hub / github.com/tinylib/msgp / BenchmarkIntegersUnix

Function BenchmarkIntegersUnix

msgp/integers_test.go:94–112  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

92}
93
94func BenchmarkIntegersUnix(b *testing.B) {
95 bytes := make([]byte, 12)
96 var sec int64 = 1609459200
97 var nsec int32 = 123456789
98
99 b.Run("Get", func(b *testing.B) {
100 binary.BigEndian.PutUint64(bytes, uint64(sec))
101 binary.BigEndian.PutUint32(bytes[8:], uint32(nsec))
102 for i := 0; i < b.N; i++ {
103 getUnix(bytes)
104 }
105 })
106
107 b.Run("Put", func(b *testing.B) {
108 for i := 0; i < b.N; i++ {
109 putUnix(bytes, sec, nsec)
110 }
111 })
112}
113
114func BenchmarkIntegersPrefix(b *testing.B) {
115 bytesU16 := make([]byte, 3)

Callers

nothing calls this directly

Calls 2

getUnixFunction · 0.85
putUnixFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…