optimise LatestMap.Merge by merging old into young

This commit is contained in:
Matthias Radestock
2016-08-23 19:34:05 +01:00
parent e8ebb31075
commit c50155bb7e
3 changed files with 51 additions and 6 deletions

View File

@@ -42,6 +42,9 @@ type Map interface {
// This operation is O(log N) in the number of keys.
Lookup(key string) (interface{}, bool)
// First returns the "first" value in the map, if any, or nil.
First() interface{}
// Size returns the number of key value pairs in the map.
// This takes O(1) time.
Size() int
@@ -348,6 +351,10 @@ func lookupLowLevel(self *tree, partialHash, hash uint64) (interface{}, bool) {
return self.value, true
}
func (m *tree) First() interface{} {
return m.value
}
func (m *tree) Size() int {
return m.count
}

4
vendor/manifest vendored
View File

@@ -1211,8 +1211,8 @@
"importpath": "github.com/weaveworks/ps",
"repository": "https://github.com/weaveworks/ps",
"vcs": "git",
"revision": "70d17b2d6f760345ef36a0748751eddf7290a92c",
"branch": "master",
"revision": "26c07ef9a67b5bd2f5707b9a1957e7492776d945",
"branch": "map-first",
"notests": true
},
{