BenchmarkHintFileDecode benchmarks the decoding of HintEntry
(b *testing.B)
| 47 | |
| 48 | // BenchmarkHintFileDecode benchmarks the decoding of HintEntry |
| 49 | func BenchmarkHintFileDecode(b *testing.B) { |
| 50 | entry := &HintEntry{ |
| 51 | BucketId: 1, |
| 52 | KeySize: 10, |
| 53 | ValueSize: 100, |
| 54 | Timestamp: uint64(time.Now().UnixMilli()), |
| 55 | TTL: 3600, |
| 56 | Flag: DataSetFlag, |
| 57 | Status: Committed, |
| 58 | Ds: DataStructureBTree, |
| 59 | DataPos: 1000, |
| 60 | FileID: 1, |
| 61 | Key: []byte("testkey123"), |
| 62 | } |
| 63 | |
| 64 | encoded := entry.Encode() |
| 65 | |
| 66 | b.ResetTimer() |
| 67 | for i := 0; i < b.N; i++ { |
| 68 | decoded := &HintEntry{} |
| 69 | _ = decoded.Decode(encoded) |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | // BenchmarkHintFileWrite benchmarks writing hint entries to file |
| 74 | func BenchmarkHintFileWrite(b *testing.B) { |