1
0
forked from MTSR/mapserver

more perf

This commit is contained in:
NatureFreshMilk 2019-01-17 16:09:11 +01:00
parent 7694ebbd41
commit af1e8142bc
2 changed files with 11 additions and 0 deletions

View File

@ -21,6 +21,7 @@ func Render(tr *tilerenderer.TileRenderer,
start := time.Now() start := time.Now()
complete_count := 512*512 complete_count := 512*512
current_count := 0 current_count := 0
perf_count := 0
jobs := make(chan coords.TileCoords, 100) jobs := make(chan coords.TileCoords, 100)
@ -37,6 +38,7 @@ func Render(tr *tilerenderer.TileRenderer,
tc := coords.NewTileCoords(x,y,10,layer.Id) tc := coords.NewTileCoords(x,y,10,layer.Id)
jobs <- tc jobs <- tc
current_count++ current_count++
perf_count++
if time.Now().Sub(start).Seconds() > 2 { if time.Now().Sub(start).Seconds() > 2 {
start = time.Now() start = time.Now()
@ -47,8 +49,10 @@ func Render(tr *tilerenderer.TileRenderer,
"y": y, "y": y,
"progress%": progress, "progress%": progress,
"layer": layer.Name, "layer": layer.Name,
"perf": perf_count,
} }
perf_count = 0
logrus.WithFields(fields).Info("Initial render progress") logrus.WithFields(fields).Info("Initial render progress")
} }
} }

View File

@ -196,6 +196,13 @@ func (tr *TileRenderer) RenderImage(tc coords.TileCoords) (*image.NRGBA, error)
png.Encode(buf, img) png.Encode(buf, img)
} }
isEmpty := upperLeft == nil && upperRight == nil && lowerLeft == nil && lowerRight == nil
if isEmpty && (tc.Zoom == 12 || tc.Zoom == 11 || tc.Zoom == 10) {
//don't cache empty zoomed tiles
return nil, nil
}
tile := tiledb.Tile{Pos: tc, Data: buf.Bytes(), Mtime: time.Now().Unix()} tile := tiledb.Tile{Pos: tc, Data: buf.Bytes(), Mtime: time.Now().Unix()}
tr.tdb.SetTile(&tile) tr.tdb.SetTile(&tile)