fablabbcn / smartcitizen-web

The Smart Citizen Kit platform
https://smartcitizen.me
GNU Affero General Public License v3.0
13 stars 7 forks source link

Slow world_map request leads to unresponsive front-end time #431

Open oscgonfer opened 3 years ago

oscgonfer commented 3 years ago

Hi,

I have noticing increasing load times for the world_map request (up to 5-10s) due to, I imagine large payloads (1,3Mb in below network trace).

image

During that time, the front-end feels unresponsive, which in some occasions feels a bit unconfortable, specially when presenting the site to others.

Just putting this here to discuss, I don't have any clear idea on how to solve it other than trying to reduce the payload for the map request and update it as the user navigates.

pral2a commented 3 years ago

Yes,

That was the primary reason I started to implement the Kits last publish slider. I don't have much time right now but we'll be good to finish it soon

https://github.com/fablabbcn/smartcitizen-web/tree/feat-map-time-range-slider

That doesn't reduce the server response nor the download time but it reduces the number of markers to be created and those it reduces the load time while improves the overall navigation experience.

The primary reason the slider works well on reducing the time is the markers are not created directly in Leaflet but instead they are created as Angular objects. I found out that operation is a bit slow.

https://github.com/fablabbcn/smartcitizen-web/blob/master/src/app/core/constructors/marker/marker.constructor.js

I will suggest you give a try to the slider branch to confirm how much it improves the loading speed. I haven't test it recently.