-
Notifications
You must be signed in to change notification settings - Fork 935
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
Unmounting Markers performance #210
Comments
Update: I forgot to mention that I also used the
Turning that off, was the whole difference actually, so now I have to figure out why this is such a performance hog in my case. |
We also faced this problem, In fact the latency comes from how the marker is added to the cluster, when the marker is added or removed, it uses the addMarker / removeMarker from the library which will do a repaint. So in fact removing 800 markers, i.e, will call 800 times the repaint method of the marker clusterer (and same when adding 800 markers) Our workaround for the moment was to rewrite the MarkerClusterer and when a marker is removed or added we save it to an array. Then on the componentDidUpdate of the MarkerClusterer we use the removeMarkers / addMarkers batch methods which are designed to remove / add markers in mass. Also another optimisation was to remove the repaint method after each update of the component as it's already well handled by the underlying library. |
Hi @joelwurtz , i'm facing the same problem. I have about 10k markers placed in Is there any chance you could share the improvement you made on I also have a question if you don't mind: is it reasonable to use the Thank you, and thanks for all the work that was put in this library ! |
We're going to look into this shortly. We're also looking for maintainers. Involve in #266 to help strengthen our community! |
* Improved performance of rendering many markers/components on the map * Closes #135 * Closes #210 * Closes #216 BREAKING CHANGE: If you're just using the library and didn't make custom components before, feel free to ignore this implementation changes. Now, mapHolderRef for each component are now passed in via context. This doesn't affect all components interface in general. But if you do custom components before and relies on the implementation of react-google-maps, you should be aware of this and make some changes.
Hello, I have map with a lot of clustered markers (about 8k). I add them all on the map without any filtering trick, it works wonderfully but it takes time to mount when first loading the page. I guess this is normal, but it takes time to unmount when going from '/map' to let's say '/dashboard'. Thank you, |
@joelwurtz could you please share your solution. the re-rendering doesnt work for me still |
Please refer to Getting Help section in the README (or #469). |
I'm using version "9.4.5" and I'm still facing this performance issue. |
I'm facing the same problem. There is a
|
Update to latest package (9.4.5) version and use option |
noRedraw={true} not helping in my case where I have over 1k markers. |
Hey guys , I still have the same issue , i updated to 9.4.5 latest as mentioned above , also added noRedraw attribute to Marker and i couldn't see any improvements on markers hover :/ . |
I have problems with performance. I have about 3000 markers on the map and markers joins in clusters. container-component with map
and
|
Thanks @tab , absolutely i have the same issue , about 2400 marker , hover (change icon to active one) takes about 2~3s and thats relatively a lot of user . i want just to make sure if the method used in code above you just shared is gonna save my life . |
Hello, is this solved in any way ? I'm experiencing this sluggish behaviour for 400 markers. |
@OrenSchwartz this library is not maintained about a year, please consider switching to it's successor rewritten with Typescript - @react-google-maps/api https://www.npmjs.com/package/@react-google-maps/api We have active community on spectrum, working examples and docs. |
Hello people,
I might have ran into some kind of limiting factor regarding this library in connection with rendering, or rather the un-rendering a larger amount of markers.
The problem is that it takes a very long tim (about 10 seconds) for React to re-render when transitioning between state 1 to 2.
State #1
~1000 pretty simple and straight forward javascript objects are held in a state key in my React component. Each of them are also rendered into the DOM by React like so:
State #2
About 20 javascript objects rendered in the same way as the above.
For some reason it takes forever (about 10 seconds) to set the new state object:
I have tried to remove everything except the position key from the marker component to se if there was some kind of problem, but it didn't help at all. I have also tried dropping the
<Marker />
altogether and instead plot the markers with Google's components directly and then usemarker.setMap(this._googleMapComponent.props.map)
to render it into the DOM. This solved the problem, I think, since the delay was gone. However, that might be because I didn't remove them from the DOM when the React state was changed. That might be clue as to what's going on.In essence, my question is, why does the removing all these markers seem to take such a long time?
Does this sound familiar or spark any ideas?
The text was updated successfully, but these errors were encountered: