func (s *KVStore) Map(msg bh.Msg, ctx bh.MapContext) bh.MappedCells { var k string switch data := msg.Data().(type) { case Put: k = string(data.Key) case Get: k = string(data) case Del: k = string(data) } cells := bh.MappedCells{ { Dict: dict, Key: strconv.FormatUint(xxhash.Checksum64([]byte(k))%s.Buckets, 16), }, } return cells }
func BenchmarkXxhash64CgoVeryShort(b *testing.B) { k := []byte("Test-key-100") for i := 0; i < b.N; i++ { C.Checksum64(k) } }
func TestHash64CgoShort(t *testing.T) { r := C.Checksum64(in) if r != expected64 { t.Errorf("expected 0x%x, got 0x%x.", expected64, r) } }
func BenchmarkXxhash64Cgo(b *testing.B) { for i := 0; i < b.N; i++ { C.Checksum64(in) } }