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

Lazy js loading overview #36728

Open
9 of 20 tasks
juliushaertl opened this issue Feb 15, 2023 · 8 comments
Open
9 of 20 tasks

Lazy js loading overview #36728

juliushaertl opened this issue Feb 15, 2023 · 8 comments
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap overview technical debt

Comments

@juliushaertl
Copy link
Member

juliushaertl commented Feb 15, 2023

@juliushaertl juliushaertl self-assigned this Feb 15, 2023
@szaimen szaimen added technical debt overview 0. Needs triage Pending check for reproducibility or if it fits our roadmap labels Feb 15, 2023
@pulsejet
Copy link
Member

Maybe unrelated to this effort, but the viewer and unsupported browser scripts are loaded synchronously and are super slow. Do you want me to look into this @juliushaertl?

@juliushaertl
Copy link
Member Author

Feel free to jump in on those topics, I don't really have much time to focus on this currently. Any contributions are welcome :)

pulsejet added a commit that referenced this issue May 17, 2023
This check is very expensive, and will pass almost 100% of the time.

Related #36728
Depends on #38329

Signed-off-by: Varun Patil <varunpatil@ucla.edu>
nextcloud-command pushed a commit that referenced this issue May 19, 2023
This check is very expensive, and will pass almost 100% of the time.

Related #36728
Depends on #38329

Signed-off-by: Varun Patil <varunpatil@ucla.edu>
nextcloud-command pushed a commit that referenced this issue May 19, 2023
This check is very expensive, and will pass almost 100% of the time.

Related #36728
Depends on #38329

Signed-off-by: Varun Patil <varunpatil@ucla.edu>
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
@szaimen
Copy link
Contributor

szaimen commented May 20, 2023

Just wanting to point out that enabling gzip content-encoding in the webserver seems to make a huge difference in terms of transferred js file sizes. core-common.js is then for example reduced from 13.3 MB to 3.5 MB. Dashboard for example loads thus in almost half the time: 7.5s vs 12.5s before in my testing without browser cache (not the fastest network connection here).

Maybe we should suggest this in the docs at least for js files or does this come with known downsides?

@szaimen
Copy link
Contributor

szaimen commented May 20, 2023

Brotli seems to look even better: reduces core-common.js down to 2.0 MB. I will enable this in AIO by default with nextcloud/all-in-one#2576 for js files.

@szaimen
Copy link
Contributor

szaimen commented May 20, 2023

btw, it looks like for some response content is by default gzip used. Is there a reason this could not be applied by Nextcloud by default for js assets?

@pulsejet
Copy link
Member

Agree, serving JS without gzip is a disaster. I'd be a bit careful with brotli though. You can't compress brotli on the fly; that'll be too slow. The use-case for brotli is serving pre-compressed artifacats, so need to make sure that is the case.

@pulsejet
Copy link
Member

We can't do anything about viewer here since it has some side effects (hooks), but lazy loading the components themselves seems to do the trick for performance. nextcloud/viewer#1675

@szaimen
Copy link
Contributor

szaimen commented May 22, 2023

I just tested this with the login page (time with new load in new private window until it shows login form) and these are the results:
(manually tracked, so possible that they are not 100% correct but I did the test multiple times to confirm that they are not completely incorrect).

~4.12s loading time without compression
~2.76s loading time with Brotli
~3.34s loading time with Deflate

So even on the fly Brotli seems to be the fastest :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap overview technical debt
Projects
None yet
Development

No branches or pull requests

3 participants