react-native-map-clustering icon indicating copy to clipboard operation
react-native-map-clustering copied to clipboard

Trouble with performance

Open kreshnikalidema opened this issue 4 years ago • 4 comments

I'm using this library and I'm having trouble with performance. I spent some time looking at the code and am seeing some issues with the mermorization. Although the higher order component React.memo is used, the mermorization is broken and ClusterMarker renders every time because it receives new reference of _onClusterPress callback.

If we want React.memo to work we need to have memorized callback, and then from inside the ClusterMarker component we need to call _onClusterPress with Id as the parameter through which we can find the cluster... but as it is now React.memo can only have a negative impact.

const _onClusterPress = useCallback(
  (clusterId) => {
    // ...
  },
  [dependencies]
);

kreshnikalidema avatar Sep 15 '21 21:09 kreshnikalidema

Did you find any solution?

ramisalem avatar Nov 18 '21 13:11 ramisalem

I created a new library, much more optimized than this.

kreshnikalidema avatar Nov 18 '21 17:11 kreshnikalidema

which library can you share with us

dhumal436 avatar Nov 22 '21 18:11 dhumal436

@kreshnikalidema is it opensource? if so please share it with us

ramisalem avatar Nov 30 '21 13:11 ramisalem