Esri / esri-loader

A tiny library to help load ArcGIS API for JavaScript modules in non-Dojo applications
Apache License 2.0
458 stars 79 forks source link

Optimizing esri-loader and ArcGIS loading speed #question #175

Closed kjcomputas closed 5 years ago

kjcomputas commented 5 years ago

Not sure if I can ask this as an issue, so please feel free to delete if this is the wrong place to ask general questions about optimizing ArcGIS JS apps using esri-loader.

I have an Angular 7 project using latest esri-loader 2.9.2 against ArcGIS JS 4.11.1.

I can read from the network log that the biggest slowdowns are the dojo.js and the pe-wasm.wasm file, both using 4-5 seconds, so a total of 10. The downloaded filesize is around 500kb.

What is your optimizing strategy? Is it possible to work around it using the esri-loader with preloading or bundling the files needed in the application? Other options? Now it takes around 20s to load the application and that is way too slow!

How do you optimize your applications to make it load faster?

andygup commented 5 years ago

@kjcomputas you are in the right place for these types of questions. Did you have a chance to take a look at the DevSummit tech session video I referenced over on GeoNET? It discusses a bunch of different optimizing strategies.

Since every app and its data are different, we really need to see a working example or some sort of code for these types of questions. There are a few options including:

[Update] Here's the link from GeoNET, https://www.youtube.com/watch?v=Jzj8fY-vBrk&list=PLaPDDLTCmy4Y0GMTl0O4V6LF3EmxIAivv&index=162&t=26m

tomwayson commented 5 years ago

I can read from the network log that the biggest slowdowns are the dojo.js and the pe-wasm.wasm file, both using 4-5 seconds, so a total of 10. The downloaded filesize is around 500kb.

What types of network speed are you getting/expecting/targeting?

If I go to @andygup's stackblitz link above, and use DevTools to throttle the network speed and I get:

W/o throttling (desktop on LAN) it's always < 1 sec.

tomwayson commented 5 years ago

Is it possible to work around it using the esri-loader with preloading

It is possible to preload the ArcGIS API, but in practice I have found it tricky to do this well unless your application has a very well-defined workflow where a user always takes certain actions before using the ArcGIS API.

or bundling the files needed in the application?

Moving the 500kb from dojo.js into your bundle isn't going to make your application load faster.

How do you optimize your applications to make it load faster?

Using esri-loader to lazy-load the ArcGIS API only when it is needed is the optimizing strategy b/c you defer that cost until it's worth while.

tomwayson commented 5 years ago

Closing due to inactivity.