make chanels buffered

master
Oliver Tonnhofer 2013-05-17 17:08:50 +02:00
parent 2b15732a5f
commit c4fb0d8a21
3 changed files with 6 additions and 7 deletions

2
cache/ways.go vendored
View File

@ -84,7 +84,7 @@ func (p *WaysCache) GetWay(id int64) (*element.Way, error) {
}
func (p *WaysCache) Iter() chan *element.Way {
way := make(chan *element.Way)
way := make(chan *element.Way, 1024)
go func() {
ro := levigo.NewReadOptions()
ro.SetFillCache(false)

View File

@ -51,10 +51,10 @@ type ErrorLevel interface {
}
func parse(cache *cache.OSMCache, progress *stats.Statistics, tagmapping *mapping.Mapping, filename string) {
nodes := make(chan []element.Node)
coords := make(chan []element.Node)
ways := make(chan []element.Way)
relations := make(chan []element.Relation)
nodes := make(chan []element.Node, 16)
coords := make(chan []element.Node, 16)
ways := make(chan []element.Way, 16)
relations := make(chan []element.Relation, 16)
positions := parser.PBFBlockPositions(filename)
@ -71,7 +71,6 @@ func parse(cache *cache.OSMCache, progress *stats.Statistics, tagmapping *mappin
relations,
)
}
//runtime.GC()
waitParser.Done()
}()
}

View File

@ -46,7 +46,7 @@ func ReadPrimitiveBlock(pos BlockPosition) *osmpbf.PrimitiveBlock {
}
func (pbf *PBF) BlockPositions() (positions chan BlockPosition) {
positions = make(chan BlockPosition)
positions = make(chan BlockPosition, 16)
go func() {
for {
offset, size := pbf.NextDataPosition()