Documentation ¶
Index ¶
- Constants
- type GoMapTester
- func (f *GoMapTester) CloneIntMapToSlice(m map[int]int, mapList []map[int]int, remaining int)
- func (f *GoMapTester) GeneratedKeyCount() (count int)
- func (f *GoMapTester) IntKeys(length int, series int) (keys []int)
- func (f *GoMapTester) PopulateIntMap(m map[int]int, length int)
- func (f *GoMapTester) SetSeriesInt(keys []int, series int)
- func (f *GoMapTester) SubBenchmarkList() (sb []SubBenchmark)
- type SubBenchmark
Constants ¶
View Source
const ( TgmRetrieveSeries = 0 // the int key series for retrieve keys TgmAssignSeries = 1 // the int key series for assign keys that are not among retrieve keys )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GoMapTester ¶
type GoMapTester struct {
// contains filtered or unexported fields
}
func NewGoMapTester ¶
func NewGoMapTester() (goMapTester *GoMapTester)
NewGoMapTester returns an object with sub-benchmarks and helper methods
func (*GoMapTester) CloneIntMapToSlice ¶
CloneIntMapToSlice populates mapList with maps.Clone of m but not more maps than remaining
func (*GoMapTester) GeneratedKeyCount ¶
func (f *GoMapTester) GeneratedKeyCount() (count int)
GeneratedKeyCount return how many keys are available
func (*GoMapTester) IntKeys ¶
func (f *GoMapTester) IntKeys(length int, series int) (keys []int)
IntKeys generate keys in random order
- length is how many keys to return. length keys are returned though keys exist for the largest sub-benchmark, typically 1M
- To avoid slow benchmarks, do not request more than 1M keys. GeneratedKeyCount returns how many keys exist after the first Keys invocation.
- series is key series, read keys are normally 0
- key of different series are never the same. series allows to quickly generating keys that are not present in series 0
- generating 1M keys is 83 ms
- shuffle 1M keys is 10 ms
- setSeries 1M keys: 73 ms
func (*GoMapTester) PopulateIntMap ¶
func (f *GoMapTester) PopulateIntMap(m map[int]int, length int)
PopulateIntMap fills map m with length elements
func (*GoMapTester) SetSeriesInt ¶
func (f *GoMapTester) SetSeriesInt(keys []int, series int)
SetSeriesInt modifies keys to be of series series
- series >= 0, <=9
- setSeries 1M keys: 1 ms
func (*GoMapTester) SubBenchmarkList ¶
func (f *GoMapTester) SubBenchmarkList() (sb []SubBenchmark)
SubbenchmarkList returns an iterable benchmark list for map lengths 1…1M
type SubBenchmark ¶
type SubBenchmark struct { Name string // Name is the name of the sub-benchmark: "10k" Length int // Length is the initial number of elements of the map being tested }
SubBenchmark is used to specify sub-benchmarks for the Go map benchmark
Click to show internal directories.
Click to hide internal directories.