<p></p>
<h3 dir="auto">URL</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">How to reproduce the issue?</h3>
<p dir="auto">I was trying to figure out why the Map Data layer is slow when displaying a lot of elements. In Firefox Profiler, I saw that a lot of time was spent on handlers for adding new objects to the map.</p>
<a href="https://github.com/user-attachments/assets/ebef23e6-1286-46af-a411-9b1fecfaa5f2">2025-01-04.21.18.56.png (view on web)</a>
<p dir="auto"><a href="https://share.firefox.dev/4a3ZXM9" rel="nofollow">https://share.firefox.dev/4a3ZXM9</a></p>
<p dir="auto">Specifically:<br>
<a href="https://github.com/openstreetmap/openstreetmap-website/blob/95b919c5d1e33688b0841c7d38602372c2e4c4a3/app/assets/javascripts/index.js#L176-L184">https://github.com/openstreetmap/openstreetmap-website/blob/95b919c5d1e33688b0841c7d38602372c2e4c4a3/app/assets/javascripts/index.js#L176-L184</a></p>
<p dir="auto">I don’t understand why these handlers need to update data about the current coordinates, and to prove their uselessness I did the following:</p>
<ol dir="auto">
<li>Updated the page with Map Data enabled</li>
<li>Waited for the data to download</li>
<li>Allowed display of a large amount of data</li>
</ol>
<p dir="auto">Rendering took a few seconds.</p>
<p dir="auto">After that, I did the same thing, but deleted the handlers with <code class="notranslate">map.off("layeradd layerremove")</code>. After that, the rendering is understated for less than a second.</p>
<p dir="auto"><a href="https://github.com/user-attachments/assets/f8232635-7e97-4bd1-87ab-1d46b7b79e70">https://github.com/user-attachments/assets/f8232635-7e97-4bd1-87ab-1d46b7b79e70</a></p>
<p dir="auto">Further movement of the map is also noticeably faster and allows you to display tens of thousands of objects.</p>
<p dir="auto">Note: <code class="notranslate">map</code> variable is not available by default, it is provided by my better-osm-org extension. This extension doesn't do anything else, and rendering performance doesn't depend on how it works.</p>
<p dir="auto">You can also analyze the performance profile collected in the video: <a href="https://share.firefox.dev/4a3ZXM9" rel="nofollow">https://share.firefox.dev/4a3ZXM9</a></p>
<h3 dir="auto">Screenshot(s) or anything else?</h3>
<p dir="auto"><em>No response</em></p>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/issues/5466">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLPIYAGDPTPTXHLZA232JAZAZAVCNFSM6AAAAABUTLUWP2VHI2DSMVQWIX3LMV43ASLTON2WKOZSG43DQOJXGQYDQMY">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAK2OLMTQEIUUQHUJAY22632JAZAZA5CNFSM6AAAAABUTLUWP2WGG33NNVSW45C7OR4XAZNFJFZXG5LFVJRW63LNMVXHIX3JMTHKKCZRAM.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><openstreetmap/openstreetmap-website/issues/5466</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/issues/5466",
"url": "https://github.com/openstreetmap/openstreetmap-website/issues/5466",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>