-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Speed up first-draw by reducing initial map size #2707
Speed up first-draw by reducing initial map size #2707
Conversation
Previously, loading a large map initialized the zoom to arbitrarily small scales. During my testing, a 3000x3000 map would load in at 0.06% zoom. Rendering all those tiles made the first draw and any user actions, including zooming back in, very very slow. This commit caps the number of tiles on screen to about 4,000 for the first draw. The user is still free to zoom out, but the app will start out much more responsive.
Okay, so you disagree with the 4000 tiles bit. I would like there to be at least some limit. 200x200 seems to be the upper limit of responsiveness on my computer. It's laggy but somewhat reasonable. Remember, this is NOT a limit on how far the user can zoom out, it's just the initial load-in scale. My goal here is to avoid the situation where the user opens a map, and tries to zoom in, but it's already zoomed out far enough that the zoom-in input takes a while to execute. The inverse is never a problem - the user can open a map and immediately zoom out, and the app will be at least as responsive to that input as the zoomed-out version. |
Yeah, let's just increase the limit instead of 64x64 we can do 256x256 for example. I think it's totally reasonable to keep the UI at least somewhat responsive by not showing the entire map beyond that size. |
Updated the size. |
I think it's a good change. We'll see whether we get any complaints eventually from people with 512x512 maps saying "fit map in view" isn't working... :-) |
Wait, what? I thought that function was only called on initialization. I didn’t see any other uses when I searched. If it is a button, we could add a Boolean parameter that’s only true on init. |
@Phlosioneer Right, the function was used both to initialize the view and can be triggered from the View menu. But I considered, that with the case you had in mind, you anyway wouldn't want to see the whole map due to potential performance issues. But maybe it makes sense to treat those cases differently. |
However you want to handle it. I missed that bit. |
Previously, loading a large map initialized the zoom to arbitrarily small
scales. During my testing, a 3000x3000 map would load in at 0.06% zoom.
Rendering all those tiles made the first draw and any user actions,
including zooming back in, very very slow.
This commit caps the number of tiles on screen to about 4,000 for the first
draw. The user is still free to zoom out, but the app will start out much
more responsive.
Split off from #2701