Skip to content

Commit

Permalink
extended cache testing
Browse files Browse the repository at this point in the history
  • Loading branch information
imgurbot12 committed Jan 20, 2018
1 parent 5ae5be5 commit 9e3646d
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,27 @@ import (
"testing"
)

/***Variables***/
var cache = NewRedBlackTree()
var kv = NewRedBlackKV()
/* Variables */
var rbc = NewRedBlackTree()
var rbkv = RBKV{}

/***Benchmarks***/
/* Benchmarks */

func BenchmarkCache(b *testing.B) {
func BenchmarkCacheRedBlackSET(b *testing.B) {
var i int64
var key string
for i = 0; i < int64(b.N); i++ {
key := strconv.FormatInt(i, 10)
cache.Set(kv, key, "fuck my shit")
key = strconv.FormatInt(i, 10)
rbc.Set(rbkv, key, "fuck my shit")
}
}

func BenchmarkCacheRedBlackGET(b *testing.B) {
var i int64
var key string
for i = 0; i < int64(b.N); i++ {
key = strconv.FormatInt(i, 10)
rbc.Get(rbkv, key)
}
}

Expand Down

0 comments on commit 9e3646d

Please sign in to comment.