webknossos
webknossos copied to clipboard
Speed up initial page loading
When loading a dataset (warm cache), the duration until the first data bucket is downloaded is ~2.5 seconds. I think, there is a chance to optimize quite a few things:
- [ ] make loading of olvy script completely async ("defer" is used but this still influences the DOMContentLoaded event)
- [ ] load web worker modules lazily (e.g., they are not even needed in the dashboard)
- [ ] reduce size of web workers (by reducing imports)
- [ ] avoid impact of standard requests (organizationIsEmpty, features, getActiveUser, ToS)
- [x] the requests themselves could be faster (e.g., organizationIsEmpty waits 40 ms for the server so that a simple false is returned) → https://github.com/scalableminds/webknossos/pull/8290 implements some speedup, but it’s still not super fast. not sure how to improve on this / where the wait time comes from.
- [ ] these requests could also be baked into the served HTML to avoid roundtrips (not sure about the downsides though)
- [ ] the initial
getMaximumZoomForAllResolutionsFromStoreJS function takes 600ms. hopefully this can be sped up - [ ] GETing the user organizations can be made lazily (either for ToS or avatar in navbar)
- [x] #8967
Not all optimizations might reduce the perceived page loading speed because requests and JS code can happen in parallel. still, less work => better.
I added some small request speedups in #8290 but the big fish in the network tab remains olvy (compare #8207).
Maybe some requests could also be parallelized (as they spend most of their frontend time waiting?) e.g. getActiveUser, buildInfo, toSAcceptance? Maybe some already are, I did not look into this further.