<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: 4.30 - Map very SLOW when adding 6000+ graphics in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/4-30-map-very-slow-when-adding-6000-graphics/m-p/1550965#M85934</link>
    <description>&lt;P&gt;Hi there,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Have you seen this sample -&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/layers-featurelayer-large-collection/?" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/sample-code/layers-featurelayer-large-collection/?&lt;/A&gt;&amp;nbsp;&lt;SPAN&gt;This sample demonstrates how to add 100,000 features to a feature collection while keeping your app interactive.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;I am not able to reproduce the behavior using client-side streamlayer. I used this app to test and it performs just fine -&amp;nbsp;&lt;A href="https://codepen.io/U_B_U/pen/xxvXqJP?editors=1000" target="_blank"&gt;https://codepen.io/U_B_U/pen/xxvXqJP?editors=1000&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 22 Oct 2024 16:19:41 GMT</pubDate>
    <dc:creator>UndralBatsukh</dc:creator>
    <dc:date>2024-10-22T16:19:41Z</dc:date>
    <item>
      <title>4.30 - Map very SLOW when adding 6000+ graphics</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/4-30-map-very-slow-when-adding-6000-graphics/m-p/1550845#M85928</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;It seems like the map gets very &lt;STRONG&gt;slow&lt;/STRONG&gt; when adding a &lt;STRONG&gt;lot of graphics at once&lt;/STRONG&gt; via &lt;STRONG&gt;applyEdits&lt;/STRONG&gt;. (addFeatures) We only fetch graphics based on an extent from our API. So this functionality is very important.&lt;/P&gt;&lt;P&gt;It looks like, when zooming in or out and new features are fetched and applied. It freezes or the apply will take 10+ seconds.&lt;/P&gt;&lt;P&gt;&lt;U&gt;Timings:&lt;/U&gt;&lt;/P&gt;&lt;P&gt;timestamp 1. Before zooming out =&amp;gt; fetching data (only 2000 assets)&lt;/P&gt;&lt;P&gt;timestamp 2. When zoomed out =&amp;gt; fetched data =&amp;gt; applied edits via ArcGIS API javascript&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="michaelkdev_0-1729582902688.png" style="width: 210px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/117736iA852C37FDE904DC6/image-dimensions/210x81?v=v2" width="210" height="81" role="button" title="michaelkdev_0-1729582902688.png" alt="michaelkdev_0-1729582902688.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="michaelkdev_1-1729582947763.png" style="width: 212px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/117737iAE6A5E0786868235/image-dimensions/212x62?v=v2" width="212" height="62" role="button" title="michaelkdev_1-1729582947763.png" alt="michaelkdev_1-1729582947763.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="michaelkdev_2-1729582973827.png" style="width: 215px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/117738i4D0BCF1D14ABE12B/image-dimensions/215x59?v=v2" width="215" height="59" role="button" title="michaelkdev_2-1729582973827.png" alt="michaelkdev_2-1729582973827.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Its getting very slow. Why does it take so long for applyEdits to process new data (addFeatures),&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maybe there is like a condition: &lt;STRONG&gt;NO APPLY EDITS when USER INPUT / ZOOM / EXTENT change&lt;/STRONG&gt;? When queuing all these actions, it gets very slow?&lt;/P&gt;&lt;P&gt;Codepen:&lt;/P&gt;&lt;P&gt;&lt;A href="https://codepen.io/michaelk95/pen/RwXLPOa?editors=1000" target="_blank"&gt;https://codepen.io/michaelk95/pen/RwXLPOa?editors=1000&lt;/A&gt;&lt;/P&gt;&lt;P&gt;StreamLayer has the same problems when adding too much at once.&lt;/P&gt;&lt;P&gt;Is it not possible to rewrite applyEdits to be faster? These are some simple pictures on a map, should not be complex I guess? In comparison with other map technologies, this could be a lot faster for client sided JS lib?&lt;/P&gt;&lt;P&gt;Thanks in Advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Oct 2024 12:42:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/4-30-map-very-slow-when-adding-6000-graphics/m-p/1550845#M85928</guid>
      <dc:creator>michaelpoa</dc:creator>
      <dc:date>2024-10-22T12:42:14Z</dc:date>
    </item>
    <item>
      <title>Re: 4.30 - Map very SLOW when adding 6000+ graphics</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/4-30-map-very-slow-when-adding-6000-graphics/m-p/1550965#M85934</link>
      <description>&lt;P&gt;Hi there,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Have you seen this sample -&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/layers-featurelayer-large-collection/?" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/sample-code/layers-featurelayer-large-collection/?&lt;/A&gt;&amp;nbsp;&lt;SPAN&gt;This sample demonstrates how to add 100,000 features to a feature collection while keeping your app interactive.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;I am not able to reproduce the behavior using client-side streamlayer. I used this app to test and it performs just fine -&amp;nbsp;&lt;A href="https://codepen.io/U_B_U/pen/xxvXqJP?editors=1000" target="_blank"&gt;https://codepen.io/U_B_U/pen/xxvXqJP?editors=1000&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Oct 2024 16:19:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/4-30-map-very-slow-when-adding-6000-graphics/m-p/1550965#M85934</guid>
      <dc:creator>UndralBatsukh</dc:creator>
      <dc:date>2024-10-22T16:19:41Z</dc:date>
    </item>
    <item>
      <title>Re: 4.30 - Map very SLOW when adding 6000+ graphics</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/4-30-map-very-slow-when-adding-6000-graphics/m-p/1551094#M85938</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/665945"&gt;@michaelpoa&lt;/a&gt;! Looking at the codepen, I see what you mean about the long freezes. But when I try running a performance profile, I'm only seeing applyEdits() take a few hundred milliseconds. It seems like a lot of time is spent in:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;the forEach() calls within&amp;nbsp;&lt;SPAN&gt;applyDataToMap()&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;intersection&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;garbage collection&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN&gt;I noticed a couple of things that might be contributing:&lt;/SPAN&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;On line 231, there's a Array.find() call within an Array.forEach() call. Maybe outside of the forEach() it'd be possible to construct an object/dict/Map to look up features by id?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;In intersects(), the feature geometry is projected into view space. That projection can be expensive, and it will generate new geometry objects that are used once and then need to be garbage collected. Maybe it's possible to project the view extent into the graphic geometry's spatial reference instead? That could be done once, outside the loop.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;If there's a way to avoid querying all the features, that will probably also help to reduce garbage collection time&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Hopefully something in there is useful!&lt;/P&gt;</description>
      <pubDate>Tue, 22 Oct 2024 20:51:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/4-30-map-very-slow-when-adding-6000-graphics/m-p/1551094#M85938</guid>
      <dc:creator>SamEngel</dc:creator>
      <dc:date>2024-10-22T20:51:20Z</dc:date>
    </item>
  </channel>
</rss>

