### Description This is fix #5466 After merging https://github.com/openstreetmap/leaflet-osm/pull/43 flame graph looks like this:
<img width="1208" src="https://github.com/user-attachments/assets/435540a1-ebe4-40e6-8051-2d881e3ed28e" /> https://share.firefox.dev/4a2Wc9Z Most of the time is spent on two handlers that update information about the current location and elements in the right sidebar. Unfortunately, replacing `layeradd layerremove` with `baselayerchange overlaylayerchange` (https://github.com/openstreetmap/openstreetmap-website/issues/5466#issuecomment-2571570472) is difficult, since in addition to the Map Data layer, other elements may be displayed on the map. For example, the currently selected object on the map. It is not clear how to separate changes to Map Data objects and changes to the selected element. It is necessary to track changes in the active element, otherwise at least the Edit button will break. Therefore, I implemented a little ugly, but safer in terms of breaking business logic. When adding the Map Data layer, I set the pause flag in the slowdown handlers. While the Map Data is rendering, the user cannot interact with the interface, so it seems safe to pause the event handlers. Total 15s vs 0.5s when rendering 5000 elements. <img width="1207" src="https://github.com/user-attachments/assets/13a099d0-0918-4c32-840d-24faf5a1cb8c" /> https://share.firefox.dev/4h4IK7C You can view, comment on, or merge this pull request online at: https://github.com/openstreetmap/openstreetmap-website/pull/5474 -- Commit Summary -- * Suspend the layer event handlers when rendering Map Data -- File Changes -- M app/assets/javascripts/index.js (6) M app/assets/javascripts/index/layers/data.js (4) M app/assets/javascripts/leaflet.layers.js (6) M app/assets/javascripts/leaflet.share.js (6) -- Patch Links -- https://github.com/openstreetmap/openstreetmap-website/pull/5474.patch https://github.com/openstreetmap/openstreetmap-website/pull/5474.diff -- Reply to this email directly or view it on GitHub: https://github.com/openstreetmap/openstreetmap-website/pull/5474 You are receiving this because you are subscribed to this thread. Message ID: <openstreetmap/openstreetmap-website/pull/5...@github.com>
_______________________________________________ rails-dev mailing list rails-dev@openstreetmap.org https://lists.openstreetmap.org/listinfo/rails-dev