cmapv2
installation
In your Go project main directory (where the go.mod file is located)
go get github.com/sirgallo/cmapv2 go mod tidy
Make sure to run go mod tidy to install dependencies.
usage
package main import ( "github.com/sirgallo/cmapv2" ) func main () { // initialize c map cMap := cmap . NewMap () // insert key/val pair cMap . Put ([] byte ( "hi" ), [] byte ( "world" )) // retrieve value for key val := cMap . Get ([] byte ( "hi" )) // delete key/val pair cMap . Delete ([] byte ( "hi" )) // ===== OR // initialize sharded c map with number of shards sMap := cmap . NewMap ( 16 ) sMap . Put ([] byte ( "hi" ), [] byte ( "world" )) val := sMap . Get ([] byte ( "hi" )) sMap . Delete ([] byte ( "hi" )) }
tests
go test -v ./tests
or bench:
go test -v -bench=. -benchmem -cpuprofile cpu.prof -memprofile mem.prof ./tests
and check results:
go tool pprof -http=:8080 tests.test cpu.prof go tool pprof -http=:8080 tests.test mem.prof
sources
CMap
Murmur
Tests