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

[Performane] : Fix slow loading of Music Blocks on all the browsers #4331

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

apsinghdev
Copy link
Contributor

@apsinghdev apsinghdev commented Feb 1, 2025

fixes: #4305

This PR fixes the slow loading of Music Blocks.

(Draft)

This PR will contain comparatively bigger changes. So I'll keep on adding commits here to describe what they do.

Current Stats

Screenshot 2025-02-01 at 2 02 51 PM

Total loading time - ~ 16.0 seconds

cc @walterbender @pikurasa

Changes

82bf4ca formats the index.html file as it was not formatted properly.
4ffa134 add header links in optimized order to efficient loading
10723b3 fixes the render-blocking issue and bring the cumulative-layout-shift score from 0.20 to 0.07
5084cf7 implements http-server replacing the SimpleHTTPServer. Upgrades HTTP from 1.0 to 1.1 with Keep-Alive enabled
e6ad80f reduces Largest Contentful Paint element from 4,297 ms to 2,400 ms

@omsuneri
Copy link
Member

omsuneri commented Feb 1, 2025

@apsinghdev I would love to contribute to this PR can you suggest me some reference

@apsinghdev
Copy link
Contributor Author

@apsinghdev I would love to contribute to this PR can you suggest me some reference

Thanks @omsuneri. I'll let you know if I need help. 🙂

@walterbender
Copy link
Member

This is already a big improvement.

One minor issue: the splash screen is no longer centered horizontally.

Screenshot From 2025-02-01 11-29-38

@apsinghdev
Copy link
Contributor Author

@walterbender Thanks for letting me know. Don't know why it didn't appear on my browser. Anyways, next task is to optimise this video as it's blocking the other ops. It's causing Largest-content-page to load in around 4530 ms.

@apsinghdev apsinghdev force-pushed the perf/musicblocks-loading branch from 10723b3 to 14518ba Compare February 12, 2025 11:53
@apsinghdev
Copy link
Contributor Author

Update:

fixed the issue: #4331 (comment)

Experimented running MB using http-server

We are using SimpleHTTPServer to run Music Blocks to the client. But, SimpleHTTPServer doesn't support advanced features like Keep-Alive. I have experimented with running MB using http-server and it has Keep-Alive by default.

Screenshot 2025-02-15 at 9 22 14 PM

Also, I found http-server is comparatively fast increasing performance scores from 70 to 75 on the lighthouse.

Screenshot 2025-02-15 at 9 30 06 PM

Getting some feedback on these ideas. Will push it soon!

cc @walterbender @pikurasa

@walterbender
Copy link
Member

maybe https-server?

@apsinghdev apsinghdev force-pushed the perf/musicblocks-loading branch from 14518ba to 5084cf7 Compare February 16, 2025 07:56
@apsinghdev
Copy link
Contributor Author

maybe https-server?

I've replaced SimpleHTTPServer with http-server. Also as we don't need python now to run MB, I have made some changes in docs as well. Please test this commit 5084cf7 to your side.

@apsinghdev
Copy link
Contributor Author

apsinghdev commented Feb 16, 2025

@walterbender I've used a custom server using express that gives us the freedom to customize things as we need and make Music Blocks really fast with its default features.

I tested it and it is showing really good performance.

Screenshot 2025-02-16 at 2 28 27 PM

If you get a chance, please test 62397de

@walterbender
Copy link
Member

Seems good to me.

@apsinghdev apsinghdev force-pushed the perf/musicblocks-loading branch from 62397de to e6ad80f Compare February 17, 2025 11:01
@apsinghdev
Copy link
Contributor Author

Seems good to me.

Thanks! I'll do more testing.

@apsinghdev apsinghdev force-pushed the perf/musicblocks-loading branch from e6ad80f to 901de5c Compare February 18, 2025 08:26
@apsinghdev apsinghdev marked this pull request as ready for review February 18, 2025 08:26
@apsinghdev
Copy link
Contributor Author

apsinghdev commented Feb 18, 2025

@walterbender, I've fixed most of the critical issues blocking MB's loading process. I've noticed two main issues that need to be worked on:

  1. Unoptimized DOM-related code: we've lots of unoptimized code that interacts with DOM leading to delays in loading.
  2. Outdated/Unoptimized libraries: Some of the libraries we are using contain unused/deprecated code and it slows the performance.

To tackle both of these issues we'd need to plan about it as these are big breaking changes that will impact the whole codebase.

For now, I've made this PR ready and will work on this issue as we discuss further. Please have a look.

@pikurasa
Copy link
Collaborator

@apsinghdev The video perfectly fills the screen now. However, the loading text is now missing.

As for load time, I tested the master branch and 62397de with the default Sol, Mi, Sol code. Both took 13 seconds to load.

@apsinghdev
Copy link
Contributor Author

apsinghdev commented Feb 19, 2025

@pikurasa Thanks for your feedback! I'll fix the missing loading text issue. Also, which tool have you used to calculate the load time?

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

Successfully merging this pull request may close these issues.

Performance: Improve how MB handles local cache
4 participants