Skip to content

Conversation

piaccho
Copy link
Collaborator

@piaccho piaccho commented Oct 2, 2025

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 the typegpu package.


Closes #1747

Copy link

github-actions bot commented Oct 2, 2025

pkg.pr.new

packages
Ready to be installed by your favorite package manager ⬇️

https://pkg.pr.new/software-mansion/TypeGPU/typegpu@f17858966dd4a20c9b58c43b08e33edb9f609766
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/noise@f17858966dd4a20c9b58c43b08e33edb9f609766
https://pkg.pr.new/software-mansion/TypeGPU/unplugin-typegpu@f17858966dd4a20c9b58c43b08e33edb9f609766

benchmark
view benchmark

commit
view commit

@piaccho
Copy link
Collaborator Author

piaccho commented Oct 2, 2025

Bundler efficiency report

example1.ts

import { f32, sizeOf } from 'typegpu/data';
console.log(sizeOf(f32));
Bundler Bundle Size (bytes)
tsdown 38756
esbuild 94104
webpack 39211

example2.ts

import * as d from 'typegpu/data';
console.log(d.sizeOf(d.f32));
Bundler Bundle Size (bytes)
tsdown 38756
esbuild 94104
webpack 39211

example3.ts

import tgpu from 'typegpu';
console.log(tgpu.resolve({ externals: {} }));
Bundler Bundle Size (bytes)
tsdown 246603
esbuild 247759
webpack 269912

@piaccho piaccho requested review from Copilot and iwoplaza October 2, 2025 12:53
Copy link

@Copilot Copilot AI left a 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.

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.

chore: Measure tree-shakeability in CI
1 participant