-
Notifications
You must be signed in to change notification settings - Fork 927
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use baselayerchange/overlaylayerchange instead of layeradd/layerremove #5474
base: master
Are you sure you want to change the base?
Conversation
|
I also saw a problem in PR: when you click the Map Data checkbox, the cookie with the current location is no longer updated |
a359de9
to
a32249e
Compare
Okay, firing events from I also replaced |
…e for speed up Map Data layer render
a32249e
to
5b37b54
Compare
With the latest changes I was able to render Lake Huron locally in a reasonable amount of time (<20s, including 4.5s API response time; 455k nodes). Also map data display is extremely fast now (e.g. 100ms instead of 3s). That is definitely a significant speed-up. Furthermore, switching from XML to JSON has improved the response time from 20s to 8s (both values include 4.5s API time). For reference, I've uploaded the quick hack here: https://gist.github.com/mmd-osm/d45ff3b4f41908b1c075d70d1b6fdebe (edit: also added fetch based alternative). We should think about adding some error handling: |
Jquery uses In a next step switching to `fetch" would allow using |
Description
This is fix #5466 After merging openstreetmap/leaflet-osm#43 flame graph looks like this:
https://share.firefox.dev/4a2Wc9Z
Most of the time is spent on two handlers that update information about the current location and elements in the right sidebar.
Unfortunately, replacing
layeradd layerremove
withbaselayerchange overlaylayerchange
(#5466 (comment)) is difficult, since in addition to the Map Data layer, other elements may be displayed on the map. For example, the currently selected object on the map. It is not clear how to separate changes to Map Data objects and changes to the selected element. It is necessary to track changes in the active element, otherwise at least the Edit button will break.Therefore, I implemented a little ugly, but safer in terms of breaking business logic. When adding the Map Data layer, I set the pause flag in the slowdown handlers. While the Map Data is rendering, the user cannot interact with the interface, so it seems safe to pause the event handlers.Total 15s vs 0.5s when rendering 5000 elements.
https://share.firefox.dev/4h4IK7C