Skip to content

Optimize initial loading times #2335

@JammingBen

Description

@JammingBen

I feel like initial loading times could still be a bit better, which gets especially noticeable on slow connections. Chunks being too big is one part of the problem (see #2332). But it's also a matter of when we load things.

The current loading flow:

The first batch of chunks consists of everything index.html loads and, as a result, the top-level imports of packages/web-runtime/src/index.ts. Next, the actual bootstrap begins via bootstrapApp(), loading a second batch of chunks (mainly config + all the apps). After the apps have been loaded, we announce the router, which then triggers the auth flow so the user gets loaded. After that, the bootstrapping process comes to an end by loading the spaces and the authenticated config (if a user is present).

I think the biggest improvement would come from parallelizing the app loading and the auth flow. This needs a bit of tinkering and testing to avoid catch-22 scenarios, but it should be possible. Plus, within bootstrapApp() and during user loading there is also room for smaller optimizations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type:MaintenanceE.g. technical debt, packaging, etc.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions