reuse freeNodes

master
Oliver Tonnhofer 2013-11-13 13:17:54 +01:00
parent c3f9992f18
commit 4eecb7fb94
1 changed files with 2 additions and 1 deletions

3
cache/delta.go vendored
View File

@ -328,10 +328,11 @@ func (self *DeltaCoordsCache) getBunch(bunchId int64) (*coordsBunch, error) {
elem := self.lruList.PushFront(bunchId)
select {
case nodes = <-freeNodes:
nodes = nodes[:0]
default:
nodes = make([]element.Node, 0, self.bunchSize)
}
bunch = &coordsBunch{id: bunchId, coords: nil, elem: elem}
bunch = &coordsBunch{id: bunchId, coords: nodes, elem: elem}
needsGet = true
self.table[bunchId] = bunch
} else {