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

Increase scope of polygon draw batching for polygons with labels. #1607

Merged
merged 2 commits into from
Aug 4, 2023

Conversation

ignatz
Copy link
Contributor

@ignatz ignatz commented Aug 4, 2023

This change contains all previous micro-optimizations plus a larger optimization extending the scope and applicability of polygon draw batching.

Previously, we'd eagerly flush a batch whenever we'd encounter a polygon with a label. However, depending on the rendered polygon and label size, it would never be drawn. In this case we don't have to and should flush.

From a composition and visual point of view, this change is a noop.

…els to allow reusing the same polygons while toggling the labels, e.g. depending on zoom level.

Also a bunch of small optimizations to minimize canvas operations (save/restore) and reduce strain on garbage collection (fewer ephemeral allocations)
…ls only if the label would actually be drawn, as determined by the layouting algorithm.
@JaffaKetchup
Copy link
Member

@ignatz Is it OK to close #1606? I'll try to have a look at this today.

@ignatz
Copy link
Contributor Author

ignatz commented Aug 4, 2023

@ignatz Is it OK to close #1606? I'll try to have a look at this today.

Of course. Closed it already. I was thinking/hoping that breaking my changes up would aid the adoption. Happy to go with whichever approach you prefer.

@JaffaKetchup
Copy link
Member

I was just thinking that if this contains all of the other, and this one includes better optimizations, why not prefer this one instead? Have I missed something?

@ignatz
Copy link
Contributor Author

ignatz commented Aug 4, 2023

I was just thinking that if this contains all of the other, and this one includes better optimizations, why not prefer this one instead? Have I missed something?

No, missing nothing :). This is a clear superset. Visually both changes are noops (minus the "padding").

Copy link
Member

@JaffaKetchup JaffaKetchup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I haven't compared performance/benchmarks, but the code looks good and the example has not changed behaviour.
Thanks for the contribution!

@JaffaKetchup JaffaKetchup merged commit 771d4c2 into fleaflet:master Aug 4, 2023
6 checks passed
@JaffaKetchup JaffaKetchup added this to In progress in v6 Release Planning Aug 4, 2023
@JaffaKetchup JaffaKetchup moved this from In progress to Done in v6 Release Planning Aug 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants