Skip to content

Conversation

@ReinisSprogis
Copy link
Contributor

This better reflects real life usage and looks better than rectangles. Updated to match single marker demo.

@ReinisSprogis
Copy link
Contributor Author

As a note. In this edited demo I noticed that when all markers are visible, preformance is ok, but as soon as I pan and some markers are outside the screen performance degrades significantly. Should be opposit, that performance improves. as less markers are on screen.

2025-07-08.22-00-37.mp4

@josxha
Copy link
Contributor

josxha commented Jul 9, 2025

many_markers.dart seems to have a formatting issue. Try to run dart format .

@JaffaKetchup
Copy link
Member

If this demo has a performance issue like @ReinisSprogis mentioned, then that needs to be fixed before merge. I'll test it out.

@ReinisSprogis
Copy link
Contributor Author

ReinisSprogis commented Jul 9, 2025

@josxha Ah. Yes. I have a custom formatting rule that allows for longer lines before brake it. dart fomat . did original formatting. And thanks for seed tip on Random, thats useful to know.

@ReinisSprogis
Copy link
Contributor Author

@JaffaKetchupI don't think it's related to the demo itself. I tested the original demo by simply swapping ColoredBox with Icon and observed the same result. ColoredBox might have been too primitive to reveal the issue. Replacing it with any slightly more complex widget causes noticeable lag.

I'm just speculating here, but maybe when all markers use the same widget, same color, size, and structure. Flutter applies some optimization under the hood, recognizing they're identical. As you can see, there's a clear difference between using colored markers and markers with a single color.

Still, it's unusual that removing markers would degrade performance, unless there's inefficient filtering happening under the hood.

 Marker(
     point: LatLng(doubleInRange(r, 37, 55), doubleInRange(r, -9, 30)),
     height: 12,
     width: 12,
     child: Icon(
         Icons.location_on,
         size: 12,
         color: Colors.primaries[r.nextInt(Colors.primaries.length)]
     ),
 ),
2025-07-09.14-00-08.mp4
2025-07-09.14-12-43.mp4

@JaffaKetchup
Copy link
Member

From what I can see, the lag occurs when markers are being added or pruned. Need to look into that. But the good news is, the culling still seems to work - when fewer markers are on screen (ignoring the initial spike caused by the culling itself somehow), it's more performant.

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, thanks!

@JaffaKetchup JaffaKetchup changed the title fix: updated many marker demo to match single marker demo by using the same marker type. fix(example): updated marker stress test to use more stressful markers Jul 9, 2025
@JaffaKetchup JaffaKetchup merged commit 6214a45 into fleaflet:master Jul 9, 2025
7 checks passed
@ReinisSprogis ReinisSprogis deleted the marker_demo_update branch July 9, 2025 13:02
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

Successfully merging this pull request may close these issues.

3 participants