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

@github-actions
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@0fbecd4d632844a2b32555db86bbb0c5675e033b
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/noise@0fbecd4d632844a2b32555db86bbb0c5675e033b
https://pkg.pr.new/software-mansion/TypeGPU/unplugin-typegpu@0fbecd4d632844a2b32555db86bbb0c5675e033b

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 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.

@github-actions
Copy link

github-actions bot commented Jan 8, 2026

📊 Bundle Size Comparison

📈 Summary

  • 📈 Increased: 0 bundles

  • 📉 Decreased: 0 bundles

  • Unchanged: 0 bundles

  • Unknown: 24 bundles

📋 Bundle Size Comparison

Test tsdown webpack
dataImportEverything.ts 80.02 kB 85.32 kB
dataImportOneDirect.ts 40.28 kB 40.75 kB
dataImportOneStar.ts 40.28 kB 40.75 kB
functionWithUseGpu.ts 268 B 276 B
functionWithoutUseGpu.ts 24 B 59 B
importEntireLibrary.ts 256.63 kB 283.63 kB
importEntireLibraryUnused.ts 0 B 0 B
stdImportEverything.ts 113.09 kB 117.58 kB
stdImportOneDirect.ts 61.97 kB 62.92 kB
stdImportOneStar.ts 61.97 kB 62.92 kB
tgpuImportEverything.ts 237.64 kB 264.27 kB
tgpuImportOne.ts 237.65 kB 264.28 kB

@software-mansion software-mansion deleted a comment from github-actions bot Jan 8, 2026
Copy link

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

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.

@aleksanderkatan aleksanderkatan marked this pull request as ready for review January 9, 2026 13:18
Copy link
Collaborator

@iwoplaza iwoplaza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🌴🌴🌴🌴🌴🌴🌴🌴

@software-mansion software-mansion deleted a comment from github-actions bot Jan 12, 2026
@software-mansion software-mansion deleted a comment from github-actions bot Jan 12, 2026
@aleksanderkatan aleksanderkatan merged commit c148fc6 into main Jan 12, 2026
4 checks passed
@aleksanderkatan aleksanderkatan deleted the chore/measure-tree-shakeability-in-ci branch January 12, 2026 09:51
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

4 participants