-
-
Notifications
You must be signed in to change notification settings - Fork 45
chore: Measure tree-shakeability in CI #1775
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
base: main
Are you sure you want to change the base?
Conversation
|
pkg.pr.new packages benchmark commit |
Bundler efficiency reportexample1.tsimport { f32, sizeOf } from 'typegpu/data';
console.log(sizeOf(f32));
example2.tsimport * as d from 'typegpu/data';
console.log(d.sizeOf(d.f32));
example3.tsimport tgpu from 'typegpu';
console.log(tgpu.resolve({ externals: {} }));
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a test application for measuring and comparing the tree-shaking and bundling efficiency of different JavaScript bundlers (tsdown, esbuild, webpack) for the typegpu package as part of CI automation.
- Adds a dedicated treeshake-test application with utilities for bundling and measuring output sizes
- Creates three example TypeScript files to test different import patterns from the typegpu package
- Implements a GitHub Actions workflow to run tree-shaking tests on pull requests
Reviewed Changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| apps/treeshake-test/utils.ts | Core bundling utilities for esbuild, webpack, and tsdown with size measurement and markdown report generation |
| apps/treeshake-test/index.ts | Main test runner that processes examples and generates results |
| apps/treeshake-test/package.json | Package configuration with bundler dependencies |
| apps/treeshake-test/tsconfig.json | TypeScript configuration for the test app |
| apps/treeshake-test/tsdown.config.ts | Configuration for tsdown bundler |
| apps/treeshake-test/examples/*.ts | Three test files demonstrating different import patterns |
| apps/treeshake-test/.gitignore | Ignores build output and results |
| .github/workflows/treeshake-test.yml | CI workflow for automated tree-shaking tests |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
📊 Bundle Size Comparison📈 Summary
📋 Bundle Size Comparison
^percent values are randomized (to be reversed before merge) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 19 out of 20 changed files in this pull request and generated 9 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const targetSize = targetGrouped[test]?.[bundler]; | ||
|
|
||
| output += ` | ${prettifySize(prSize)} ${ | ||
| calculateTrendMessage(prSize, Math.random() * 100000) |
Copilot
AI
Jan 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hard-coded Math.random() is used instead of targetSize for the comparison. This will produce incorrect trend messages showing random changes rather than actual differences between PR and target branches.
| calculateTrendMessage(prSize, Math.random() * 100000) | |
| calculateTrendMessage(prSize, targetSize) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will change this before merging, but for now I'll keep it for illustration purposes
iwoplaza
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🌴🌴🌴🌴🌴🌴🌴🌴
Changes
This PR introduces a test application for measuring and comparing the tree-shaking and bundling efficiency of different JS bundlers (
tsdown,esbuild,webpack) for thetypegpupackage.Closes #1747