summaryrefslogtreecommitdiffstats
path: root/map_test.go
diff options
context:
space:
mode:
authorMarc Pervaz Boocha <marcpervaz@qburst.com>2025-02-20 17:58:55 +0530
committerMarc Pervaz Boocha <marcpervaz@qburst.com>2025-02-20 17:58:55 +0530
commit2f95efc236520485c7cc1439acae24140657d76c (patch)
tree10eac60e3eec8e6b3bb9c27e131cd531363c39d6 /map_test.go
parentAdded Eviction and Options setup (diff)
downloadcache-2f95efc236520485c7cc1439acae24140657d76c.tar
cache-2f95efc236520485c7cc1439acae24140657d76c.tar.gz
cache-2f95efc236520485c7cc1439acae24140657d76c.tar.bz2
cache-2f95efc236520485c7cc1439acae24140657d76c.tar.lz
cache-2f95efc236520485c7cc1439acae24140657d76c.tar.xz
cache-2f95efc236520485c7cc1439acae24140657d76c.tar.zst
cache-2f95efc236520485c7cc1439acae24140657d76c.zip
Add Tests and benchmarks
Diffstat (limited to 'map_test.go')
-rw-r--r--map_test.go22
1 files changed, 10 insertions, 12 deletions
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)
+ }
}