googlemaps / googlemaps/js-markerclusterer

[ClusterStats] compute lazily

Open
#645 1 comment 0 reactions 0 assignees View on GitHub
good first issue priority: p3 type: feature request
Dominant language
TypeScript
Stars
293
Forks
104
Avg merge
3m
Merged PRs (30d)
18

Description

As of today the stats are computed eagerly as they are constructed:

https://github.com/googlemaps/js-markerclusterer/blob/e8eecf49b1d1f59579f3316c705f2c131b796560/src/renderer.ts#L35-L50

That's wasted CPU cycles when the stats are not required (i.e. with a custom renderer).

We should compute the stats lazily when one of the `markers`'s property is first accessed to avoid that.

This could be done in a backward compatible way using getters.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.