You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just noting a few performance issues I've hit in the past, and listing them could be useful for any thoughts on performance improvements here as well, either that we've found, or could be useful in future.
Things that I've spotted that can make a big difference.
TextPainters can be very slow to initialise, they are quite expensive, so it's good to avoid those being initialised every frame. If those can be cached, it can make a big difference. Iirc they can't be reused without recalculation if they have to be rescaled, but if they stay the same size on screen, they should be able to be reused.
Paths with a strokeWidth of > 1px are very slow in flutter (possibly with the combination of a transform). I've raised this before, and hairline strokes have a very fast algorithm, so they can be preferred in some places (especially if pinchzooming). I've never found a good solution to this though, other than slightly hacky solutions.
Removing the amount of labels (probably by some collision detection or other strategy, as well as styling).
Checking shouldRepaint is set correctly (note even if repaint is false, when scaling, there is some form of recalculation behind the scenes which can be slow)
Using RepaintBoundary on tiles/canvases etc.
The text was updated successfully, but these errors were encountered:
Thanks for your thoughts Ian! I'm going to close this one off since there's nothing actionable here, but it will stick around in case we need it later.
Just noting a few performance issues I've hit in the past, and listing them could be useful for any thoughts on performance improvements here as well, either that we've found, or could be useful in future.
Things that I've spotted that can make a big difference.
TextPainters can be very slow to initialise, they are quite expensive, so it's good to avoid those being initialised every frame. If those can be cached, it can make a big difference. Iirc they can't be reused without recalculation if they have to be rescaled, but if they stay the same size on screen, they should be able to be reused.
Paths with a strokeWidth of > 1px are very slow in flutter (possibly with the combination of a transform). I've raised this before, and hairline strokes have a very fast algorithm, so they can be preferred in some places (especially if pinchzooming). I've never found a good solution to this though, other than slightly hacky solutions.
Removing the amount of labels (probably by some collision detection or other strategy, as well as styling).
Checking shouldRepaint is set correctly (note even if repaint is false, when scaling, there is some form of recalculation behind the scenes which can be slow)
Using RepaintBoundary on tiles/canvases etc.
The text was updated successfully, but these errors were encountered: