Render optimization regarding updateData on a source. #5992
Closed
wayofthefuture
started this conversation in
Ideas
Replies: 2 comments 4 replies
-
I'm not 100% sure this is the case, but I'm guessing that there are things that need to be animated as part of the data update and thus the spikes in render count, but feel free to try and optimize this. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Do you mean things that need to be animated in Maplibre or our application? In the codepen you'll notice that we are only adding 1 polygon and removing 1 polygon once per second. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
In PR (#1605), updateData was added as an optimization for setData so that sources could be modified incrementally resulting in performance gains. In our application we call updateData once per second with considerable feature changes, and use heavy animations as well, so we are seeking to optimize performance as much as possible. We have been tracking re-renders of the map and are wondering if there could be further performance enhancement regarding updateData and map re-renders. When using updateData (or setData) to add/remove 1 feature per second, it triggers about 30-50 map renders per second. Could there be a significant performance improvement by batching updates somehow prior the next requestAnimationFrame resulting in 1 map re-render per updateData? I'm new to Maplibre and don't understand why the removal/addition of one polygon on a source would cause so many renders to occur. If there was a way to reduce this render count, or possibly pause rendering on the map pending source modification, I think it could greatly improve performance (at least in our application). The 'render' event is fired in map.ts once in the render event and it doesn't appear to be fired anywhere else. Please see the following code pen below where we remove/add 1 polygon per second via updateData and the render count is indicated at the top of the page: https://codepen.io/wayofthefuture/pen/zxGzovK?editors=0010
Beta Was this translation helpful? Give feedback.
All reactions