Created
December 12, 2017 02:55
-
-
Save ravisantoshgudimetla/48d0fc749ac100d90655ff47f155ced9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package KVStore | |
import ( | |
"fmt" | |
"strconv" | |
"testing" | |
) | |
var cacheSize = int(50000) | |
var store = make(Store, cacheSize) | |
func populateKVStore() { | |
var item Item | |
for i := 0; i < cacheSize; i++ { | |
item.Key = strconv.Itoa(i) | |
item.Val = i | |
store.Put(item) | |
} | |
} | |
func BenchmarkStore_Put(b *testing.B) { | |
populateKVStore() | |
} | |
func BenchmarkStore_Get(b *testing.B) { | |
for i := 0; i < cacheSize; i++ { | |
fmt.Println(store.Get(strconv.Itoa(i))) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment