@AndyGup, thank you for your response.
When I started adding code to a sample Stackblitz repo, I found that until I added all the layers to my map. The map was very smooth. When I started creating multiple layers from a collection of services in a JSON file and added them to the map, it became slow and laggy.
for (var layer in this.servicesArray) {
var layerTitle = this.servicesArray[layer].name_ar;
var layerId = this.servicesArray[layer].name_en;
var test = new MapImageLayer({
url: this.servicesArray[layer].serviceLayers,
title: layerTitle,
id: layerId,
visible: false
});
map.add(test);
}
The problem is also mentioned in this post here: https://community.esri.com/t5/arcgis-api-for-javascript-questions/reduce-lag-and-improve-performance....
I cannot share an example of it since it contains sensitive layer URLs.
I also tried creating all the layers, pushing them into an array, and using the 'addMany()' methods for the array. But it also does not solve the issue.
I have also turned the layer visibility off at the time of creation.
I would appreciate it if other collaborators can also provide suggestions to resolve this issue. @ReneRubalcava @UndralBatsukh @KenBuja
Abdur Rahman
GIS Developer