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

CI: detect perf/size regressions (build size bot, lighthouse...) #3521

Closed
slorber opened this issue Oct 2, 2020 · 10 comments
Closed

CI: detect perf/size regressions (build size bot, lighthouse...) #3521

slorber opened this issue Oct 2, 2020 · 10 comments
Labels
feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future. mlh Major League Hacking Fellowship

Comments

@slorber
Copy link
Collaborator

slorber commented Oct 2, 2020

Integrate Build Size Bot

Integrate build size bot (or alternatives) to run on PRs to detect bundle size and performance regressions whenever changes are made to the repository.

Example of Next.js PR

@slorber slorber added feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future. status: needs triage This issue has not been triaged by maintainers mlh Major League Hacking Fellowship and removed status: needs triage This issue has not been triaged by maintainers labels Oct 2, 2020
@hamzahamidi
Copy link
Contributor

Is it Ok to use the code source of the action created by Next.js ?

@slorber
Copy link
Collaborator Author

slorber commented Oct 16, 2020

@hamzahamidi thanks for your contributions.

The issues with MLH tags are for MLH interns joining us for 2 months.
As they just arrived I'd like to see how we assign the issues with the MLH tags first, and maybe delegate those issues to other contributors if MLH interns are already busy.

If you are looking to help on something, maybe we can get in touch on Discord so that we find an issue for you?

@jcs98
Copy link
Contributor

jcs98 commented Nov 2, 2020

Hello @slorber may I take this up?

@slorber
Copy link
Collaborator Author

slorber commented Nov 2, 2020

yes thanks, let me know if you need me to do something about it

@jcs98
Copy link
Contributor

jcs98 commented Nov 2, 2020

Hi,
This is what I have in mind:
On a new PR, the GitHub action will run yarn build and then
Calculate the build size as the sum of all the lib folders in the 15 docusaurus packages
And also the time it took to execute the build

Can you please tell me if this is okay or something else is expected?

Example comment by the build-size-bot:

Package Name Build Size Build Time
docusaurus-init 120KB 32s
docusaurus-migrate 40KB 12s
... ... ...
Total 300KB 82s

@slorber
Copy link
Collaborator Author

slorber commented Nov 2, 2020

Hi @jcs98

Tracking the size of our NodeJS code is probably not the most important thing to track.

What matters most are:

  • tracking build time (on our init template + our v2 website)
  • tracking static output size (size of HTML files, size of JS bundles etc...)

The system should be able to prevent major perf regressions such as:

  • we included lodash in theme-classic by mistake, and client side JS code increase significantly
  • we have a perf issue in node code (like sync/blocking fs access), and this increase build time significantly

Also, it's worth looking at the existing tools. Maybe some tools can already provide us useful information. I'm pretty sure there are Webpack stats plugins that we could use.

Can you do some research of existing things you can use?
The goal is not necessarily to implement everything from scratch, but figure out a simple/good enough solution with a good ROI. Don't hesitate to look at the setup of existing frameworks. NextJS is an example, but we don't need to go this far.

@jcs98
Copy link
Contributor

jcs98 commented Nov 4, 2020

Thank you @slorber
I have started looking at a few things.

Can you please confirm if "tracking static output size" is calculating the size of the folder website/build or something else?
Sorry if I am missing something here.

I also looked at some existing tools:

Would any of these work here?

@slorber
Copy link
Collaborator Author

slorber commented Nov 5, 2020

Yes, we'll likely want to track if the site of a Docusaurus site grows, mostly in website/build.

We need to define the relevant metrics for our usecase, and figure out how to measure them and track them over time to avoid regressions.

Some metrics I can think of:

  • Build time
  • Webpack chunks bundle sizes (can maybe found in Webpack manifest / stats output?)
  • Lighthouse score
  • Accessibility scores
  • ... anything relevant

We may even try to partner with external saas that offers free plans for open-source (like calibreapp.com?) to get high-quality tracking.

@slorber
Copy link
Collaborator Author

slorber commented Nov 5, 2020

Don't hesitate to try multiple services at the same time, we can try many of them, and after a while only keep the ones that we find the most useful.

Just try to get a not too verbose output, because measuring the size of all the /build folder is probably not very relevant for our usecase.

You can also try SaaS services as well, and see if they offer open-source free licenses.

@jcs98
Copy link
Contributor

jcs98 commented Nov 6, 2020

Thank you for the direction!
I'll try a few different things and keep you posted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future. mlh Major League Hacking Fellowship
Projects
None yet
Development

No branches or pull requests

3 participants