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

[FEATURE] Faster page loads #225

Open
OvermindDL1 opened this issue Jul 15, 2020 · 2 comments
Open

[FEATURE] Faster page loads #225

OvermindDL1 opened this issue Jul 15, 2020 · 2 comments

Comments

@OvermindDL1
Copy link

Currently when swapping between pages the page takes a second before any words appear on an old system at work here, it seems to be because of javascript loading (the rust iframe isn't even loaded yet so it's not the issue). Preventing the javascript from loading each and ever page load would allow swapping between pages a lot faster on slower systems and use less battery on mobile. There are a multitude of ways to do this but generally I opt for unpoly as it can be loaded on the page, then you decorate (just add some attributes to) some links that you want to it do a swap with and instead of the browser downloading the next page, reparsing the javascript, reloading the CSS, etc... it instead does a quick swap of the DOM elements, no reloading of anything else (unless you specify). You can control what is swapped as well though that's less interesting for pages like these. If you need to do something like run some javascript on elements when they get loaded it has a registry for that (think jquery-like matching but significantly faster, it doesn't use jquery). However there are other options, turbolinks is popular but it's less drop-in-and-work while being a lot slower.

Overall this would be a fairly minimal change and would decrease loading times substantially on lower-end hardware (especially as it can optionally prefetch the next page as well for instant swaps). And as it is decorative and enhancement only, the site still falls back to working as it does now when JS is disabled or the site is loaded in a browser without JS (like most CLI browsers).

@Zerotask
Copy link
Contributor

Zerotask commented May 13, 2021

@OvermindDL1 I tested it out and it looks interesting. It worked directly although I did not see any rust playgrounds (iframe).
I didn't dig deeper into this library, maybe you know how to solve this problem.

The page load times are currently pretty good, I also optimized it with my last PRs. So this would be nice to have, but not mandatory anymore.

Edit: It seems to work with iframes. Rust Playground is at the moment just very slow for me. I will create a PR later.

@OvermindDL1
Copy link
Author

It worked directly although I did not see any rust playgrounds (iframe).
I didn't dig deeper into this library, maybe you know how to solve this problem.

It should work with iframe's, I use them with iframes without issue?

Edit: It seems to work with iframes. Rust Playground is at the moment just very slow for me. I will create a PR later.

Ah, yeah if the playground is slow not much can be done about that from the client. As long as the iframe loads it's contents asynchronously then it's fine anyway, which is the default in browsers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants