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

Services refactor #36400

Closed
wants to merge 4 commits into from
Closed

Services refactor #36400

wants to merge 4 commits into from

Conversation

samouri
Copy link
Member

@samouri samouri commented Oct 18, 2021

summary

Modifies services/index.js to be a series of top level exported functions instead of a class full of static functions. Essentially a revert of #10460.
Addresses part of #35264 (comment), and #36453

why
Closure is able to optimize these whereas esbuild does not DCE the static funcs.

the big caveat
static functions on a class are stubbable whereas namespace imports are not.
This PR only passes because we use babel to transform to cjs modules before running tests.
I do not know if this is a good idea, but we need to come up with some way to DCE unused code.

results

v0.mjs brotli v0.mjs
closure compiler on main 60.82 212.68
closure compiler on this branch 60.95 212.68
esbuild on main 63.25 232.76
esbuild on this branch 62.65 227.16

@samouri samouri self-assigned this Oct 18, 2021
@samouri
Copy link
Member Author

samouri commented Oct 26, 2021

Closing due to #36486

@samouri samouri closed this Oct 26, 2021
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.

1 participant