MCPcopy Create free account
hub / github.com/nutsdb/nutsdb / BenchmarkHintFileDecode

Function BenchmarkHintFileDecode

hintfile_bench_test.go:49–71  ·  view source on GitHub ↗

BenchmarkHintFileDecode benchmarks the decoding of HintEntry

(b *testing.B)

Source from the content-addressed store, hash-verified

47
48// BenchmarkHintFileDecode benchmarks the decoding of HintEntry
49func 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
74func BenchmarkHintFileWrite(b *testing.B) {

Callers

nothing calls this directly

Calls 2

EncodeMethod · 0.95
DecodeMethod · 0.95

Tested by

no test coverage detected