Skip to content

Instantly share code, notes, and snippets.

@ravisantoshgudimetla
Created December 12, 2017 02:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ravisantoshgudimetla/48d0fc749ac100d90655ff47f155ced9 to your computer and use it in GitHub Desktop.
Save ravisantoshgudimetla/48d0fc749ac100d90655ff47f155ced9 to your computer and use it in GitHub Desktop.
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