| 92 | } |
| 93 | |
| 94 | func 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 | |
| 114 | func BenchmarkIntegersPrefix(b *testing.B) { |
| 115 | bytesU16 := make([]byte, 3) |