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

Use a Set of markers instead of an array #627

Open
vicb opened this issue May 21, 2023 · 1 comment
Open

Use a Set of markers instead of an array #627

vicb opened this issue May 21, 2023 · 1 comment
Assignees
Labels
triage me I really want to be triaged. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@vicb
Copy link
Contributor

vicb commented May 21, 2023

The clusterer uses an array of markers:

markers?: Marker[];

This is inefficient has the lib often scans the whole list (and by definition the list is big when you use the clusterer):

if (this.markers.includes(marker)) {
return;
}

const index = this.markers.indexOf(marker);

switching to a Set would be much more efficient.

I could volunteer that code if using a Set is ok with the targeted list of supported browsers - let me know

@vicb vicb added triage me I really want to be triaged. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. labels May 21, 2023
@bdcoder2
Copy link

bdcoder2 commented Feb 6, 2024

Input into any clusterer should NOT be based on Google Map Markers; which was a design flaw from the get-go as map markers should only be created for display in the map viewport - thus saving time and memory.

Input to a clusterer should be based on a "key" value which is associated with a latitude and longitude; in which case a Map would be ideal. Proof of such a concept is shown at: Creating data points vs creating Google map markers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage me I really want to be triaged. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

3 participants