Skip to content
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

Suboptimal initial load of web app #3277

Closed
ochrons opened this issue Dec 3, 2024 · 0 comments · Fixed by #3531
Closed

Suboptimal initial load of web app #3277

ochrons opened this issue Dec 3, 2024 · 0 comments · Fixed by #3531
Assignees
Labels
cli Related to the dioxus-cli program performance web relating to the web renderer for dioxus

Comments

@ochrons
Copy link

ochrons commented Dec 3, 2024

Problem

When a Dioxus web app is initially loaded by the browser it's loaded slower than necessary.

Steps To Reproduce

Steps to reproduce the behavior:

Expected behavior

Resources needed by the Dioxus app should be loaded with minimal amount of requests and utilize browser preloading capabilities.

How to improve

Here is a screenshot of a typical page load in Chrome using a slow network to make the problem more visible

image

(don't mind about CSS being loaded twice with different names)

First issue is that web.js is downloaded twice, because the preload attribute is not respected by the browser due to missing crossorigin attribute, which is also visible as a warning in console

101:17 A preload for 'http://127.0.0.1:8080/wasm/web.js' is found, but is not used because 
the request credentials mode does not match. Consider taking a look at crossorigin attribute.

Second problem is the number of JS files loaded in a cascading manner. These should all be bundled into a single JS file and served at once. There is also the issue of max 6 TCP connections with HTTP/1.1 that causes stalling, but that's not a real issue in production environment with HTTP/2 or HTTP/3. Even if the connection has high bandwidth but there is a long latency (server on the other side of the globe), these JS file loads will be the bottleneck.

Finally, application assets like CSS should be compressed with Brotli, which is already done to the Dioxus WASM and JS files.

Environment:

  • Dioxus version: 0.6.0-rc.0
  • Rust version: 1.83
  • OS info: WSL
  • App platform: fullstack web

Questionnaire

@ealmloff ealmloff added web relating to the web renderer for dioxus cli Related to the dioxus-cli program performance labels Dec 3, 2024
@ealmloff ealmloff self-assigned this Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Related to the dioxus-cli program performance web relating to the web renderer for dioxus
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants