Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance tweaks #3

Closed
ibrierley opened this issue Jun 8, 2021 · 1 comment
Closed

Performance tweaks #3

ibrierley opened this issue Jun 8, 2021 · 1 comment

Comments

@ibrierley
Copy link

ibrierley commented Jun 8, 2021

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.

@greensopinion
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants