js-markerclusterer
js-markerclusterer copied to clipboard
[ClusterStats] compute lazily
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.