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

Better production stripping - 61KB smaller, 63% of main's size, 2.7x smaller #149

Merged
merged 4 commits into from
Jan 12, 2024

Conversation

NullVoxPopuli
Copy link
Contributor

@NullVoxPopuli NullVoxPopuli commented Jan 6, 2024

Paired with work here, and will require local linking: starbeamjs/dev-compile#5

Each package creates an index.production.js.

Before this PR:

❯ pnpm turbo build --force --no-cache

❯ du --ignore_hidden --only-file --reverse --apparent-size \
     --filter "packages\/universal\/.+\/dist\/index\.production\.js$" \
     --no-percent-bars \
     --ignore-directory packages/universal/verify/
 97K └─┬ .
 26K   ├── ./packages/universal/debug/dist/index.production.js
 24K   ├── ./packages/universal/collections/dist/index.production.js
7.8K   ├── ./packages/universal/universal/dist/index.production.js
7.1K   ├── ./packages/universal/core-utils/dist/index.production.js
6.7K   ├── ./packages/universal/runtime/dist/index.production.js
6.2K   ├── ./packages/universal/reactive/dist/index.production.js
5.3K   ├── ./packages/universal/shared/dist/index.production.js
5.1K   ├── ./packages/universal/resource/dist/index.production.js
2.7K   ├── ./packages/universal/tags/dist/index.production.js
2.0K   ├── ./packages/universal/renderer/dist/index.production.js
1.7K   ├── ./packages/universal/service/dist/index.production.js
1.2K   ├── ./packages/universal/modifier/dist/index.production.js
264B   └── ./packages/universal/core/dist/index.production.js

After this PR:

❯ pnpm turbo build --force --no-cache
# not using cache, because locally, I've been changing things outside of what turbo can see

❯ du --ignore_hidden --only-file --reverse --apparent-size \
     --filter "packages\/universal\/.+\/dist\/index\.production\.js$" \
     --no-percent-bars \
     --ignore-directory packages/universal/verify/
 36K └─┬ .
 12K   ├── ./packages/universal/collections/dist/index.production.js
4.2K   ├── ./packages/universal/universal/dist/index.production.js
3.3K   ├── ./packages/universal/reactive/dist/index.production.js
3.3K   ├── ./packages/universal/runtime/dist/index.production.js
2.7K   ├── ./packages/universal/core-utils/dist/index.production.js
2.3K   ├── ./packages/universal/shared/dist/index.production.js
1.9K   ├── ./packages/universal/resource/dist/index.production.js
1.6K   ├── ./packages/universal/debug/dist/index.production.js
1.4K   ├── ./packages/universal/tags/dist/index.production.js
1.3K   ├── ./packages/universal/renderer/dist/index.production.js
876B   ├── ./packages/universal/modifier/dist/index.production.js
829B   ├── ./packages/universal/service/dist/index.production.js
220B   └── ./packages/universal/core/dist/index.production.js

Notes:

  • @starbeam/universal is an optional package that has some very helpful reactive collections for map, array, weakmap, etc

  • @starbeam/verify is a testing utilities package

  • Smallerness calculated via: 1 - 36/97 =~ 63%. and 97/36 =~ 2.7

Copy link

stackblitz bot commented Jan 6, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link

New dependencies detected. Learn more about Socket for GitHub ↗︎

Packages Version New capabilities Transitives Size Publisher
@starbeam-dev/compile 1.1.0 environment +3502 15.8 GB nullvoxpopuli

@NullVoxPopuli NullVoxPopuli changed the title Better production stripping Better production stripping - 63% smaller Jan 9, 2024
@NullVoxPopuli NullVoxPopuli changed the title Better production stripping - 63% smaller Better production stripping - 63% of main's size, 2.7x smaller Jan 9, 2024
@NullVoxPopuli NullVoxPopuli changed the title Better production stripping - 63% of main's size, 2.7x smaller Better production stripping - 61KB smaller, 63% of main's size, 2.7x smaller Jan 9, 2024
@NullVoxPopuli NullVoxPopuli marked this pull request as ready for review January 12, 2024 16:22
@NullVoxPopuli
Copy link
Contributor Author

There is more work to be done, but we're going to merge and iterate.

In particular, I want to add a test that prevents side-effecting imports in production.

@NullVoxPopuli NullVoxPopuli merged commit 9b5a07d into main Jan 12, 2024
6 checks passed
@NullVoxPopuli NullVoxPopuli deleted the better-production-stripping branch January 12, 2024 16:27
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