BenchmarkHintFileEncode benchmarks the encoding of HintEntry
(b *testing.B)
| 25 | |
| 26 | // BenchmarkHintFileEncode benchmarks the encoding of HintEntry |
| 27 | func BenchmarkHintFileEncode(b *testing.B) { |
| 28 | entry := &HintEntry{ |
| 29 | BucketId: 1, |
| 30 | KeySize: 10, |
| 31 | ValueSize: 100, |
| 32 | Timestamp: uint64(time.Now().UnixMilli()), |
| 33 | TTL: 3600, |
| 34 | Flag: DataSetFlag, |
| 35 | Status: Committed, |
| 36 | Ds: DataStructureBTree, |
| 37 | DataPos: 1000, |
| 38 | FileID: 1, |
| 39 | Key: []byte("testkey123"), |
| 40 | } |
| 41 | |
| 42 | b.ResetTimer() |
| 43 | for i := 0; i < b.N; i++ { |
| 44 | _ = entry.Encode() |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | // BenchmarkHintFileDecode benchmarks the decoding of HintEntry |
| 49 | func BenchmarkHintFileDecode(b *testing.B) { |