From 2f95efc236520485c7cc1439acae24140657d76c Mon Sep 17 00:00:00 2001 From: Marc Pervaz Boocha Date: Thu, 20 Feb 2025 17:58:55 +0530 Subject: Add Tests and benchmarks --- map_test.go | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'map_test.go') diff --git a/map_test.go b/map_test.go index 328e03f..5610d0a 100644 --- a/map_test.go +++ b/map_test.go @@ -95,22 +95,20 @@ func BenchmarkStoreGet(b *testing.B) { key := []byte("Key") store.Set(key, []byte("Store"), 0) - b.SetBytes(1) - b.RunParallel(func(pb *testing.PB) { - for pb.Next() { - store.Get(key) - } - }) + b.ReportAllocs() + + for i := 0; i < b.N; i++ { + store.Get(key) + } } func BenchmarkStoreSet(b *testing.B) { store := setupTestStore(b) key := []byte("Key") - b.SetBytes(1) - b.RunParallel(func(pb *testing.PB) { - for pb.Next() { - store.Set(key, []byte("Store"), 0) - } - }) + b.ReportAllocs() + + for i := 0; i < b.N; i++ { + store.Set(key, []byte("Store"), 0) + } } -- cgit v1.2.3-70-g09d2