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

Function BenchmarkHintFileEncode

hintfile_bench_test.go:27–46  ·  view source on GitHub ↗

BenchmarkHintFileEncode benchmarks the encoding of HintEntry

(b *testing.B)

Source from the content-addressed store, hash-verified

25
26// BenchmarkHintFileEncode benchmarks the encoding of HintEntry
27func 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
49func BenchmarkHintFileDecode(b *testing.B) {

Callers

nothing calls this directly

Calls 1

EncodeMethod · 0.95

Tested by

no test coverage detected