dmap

package module
v1.0.0-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 7, 2022 License: Unlicense Imports: 3 Imported by: 0

README

DMap

A generics-based simple, vertically distrubuted map structure. Supports keys of types that implement a String() method (fmt.Stringer interface), and any values.

Benchmarks
go test -bench=Benchmark -benchmem -benchtime=100x .
goos: linux
goarch: amd64
pkg: github.com/althk/dmap
cpu: Intel(R) Core(TM) i7-1065G7 CPU @ 1.30GHz
BenchmarkSet/100000_keys-8         	     100	    608383 ns/op	  200617 B/op	    5024 allocs/op
BenchmarkSet/1000000_keys-8        	     100	   6633708 ns/op	 1959989 B/op	   50347 allocs/op
BenchmarkGet-8                     	     100	      1492 ns/op	      40 B/op	       2 allocs/op
BenchmarkKeys-8                    	     100	   5445090 ns/op	 8944281 B/op	      56 allocs/op
BenchmarkCount-8                   	     100	       109.7 ns/op	       0 B/op	       0 allocs/op
PASS
ok  	github.com/althk/dmap	3.770s


Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DMap

type DMap[K comparable, V any] []*Shard[K, V]

func New

func New[K comparable, V any](nShards int) DMap[K, V]

func (DMap[K, V]) Count

func (m DMap[K, V]) Count() int64

func (DMap[K, V]) Get

func (m DMap[K, V]) Get(key K) (V, bool)

func (DMap[K, V]) Has

func (m DMap[K, V]) Has(key K) bool

func (DMap[K, V]) Keys

func (m DMap[K, V]) Keys() []K

func (DMap[K, V]) Remove

func (m DMap[K, V]) Remove(key K)

func (DMap[K, V]) Set

func (m DMap[K, V]) Set(key K, val V)

type Shard

type Shard[K comparable, V any] struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL