Skip to content

Conversation

@OscarCookeAbbott
Copy link
Contributor

@OscarCookeAbbott OscarCookeAbbott commented Nov 17, 2025

Motivation

This is an initial, successful version of some dead code elimination transformers to replace Babel transformers in Jira SSR.

The transformers successfully replace the Babel original's functionally (successful build and SSR render) but is likely to see a small followup PR in future to get the output aesthetically as close to 1:1 as possible (less comment removal/addition, perhaps some other small changes).

All new functionality is opt-in via env config as with my previous transformers, so they will not adversely affect any other projects.

Changes

  • Implement new dead_returns_remover transformer and hook up via opt-in flag
  • Implement new unused_bindings_remover transformer and hook up via opt-in flag

Checklist

  • Existing or new tests cover this change
  • There is a changeset for this change, or one is not required
  • Added documentation for any new features to the docs/ folder

@changeset-bot
Copy link

changeset-bot bot commented Nov 17, 2025

🦋 Changeset detected

Latest commit: 6724864

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 75 packages
Name Type
@atlaspack/transformer-js Minor
@atlaspack/rust Minor
@atlaspack/config-default Patch
atlaspack Patch
@atlaspack/bundler-experimental Patch
@atlaspack/bundler-default Patch
@atlaspack/cache Patch
@atlaspack/core Patch
@atlaspack/fs Patch
@atlaspack/logger Patch
@atlaspack/utils Patch
@atlaspack/link Patch
@atlaspack/optimizer-image Patch
@atlaspack/optimizer-inline-requires Patch
@atlaspack/packager-js Patch
@atlaspack/transformer-compiled-css-in-js Patch
@atlaspack/transformer-html Patch
@atlaspack/transformer-postcss Patch
@atlaspack/transformer-svg Patch
@atlaspack/transformer-tokens Patch
@atlaspack/node-resolver-core Patch
@atlaspack/config-webextension Patch
@atlaspack/cli Patch
@atlaspack/register Patch
@atlaspack/test-utils Patch
@atlaspack/inspector Patch
@atlaspack/query Patch
@atlaspack/bundle-stats Patch
@atlaspack/reporter-bundle-stats Patch
@atlaspack/transformer-image Patch
@atlaspack/inspector-frontend Patch
@atlaspack/package-manager Patch
@atlaspack/workers Patch
@atlaspack/watcher-watchman-js Patch
@atlaspack/optimizer-blob-url Patch
@atlaspack/optimizer-css Patch
@atlaspack/optimizer-data-url Patch
@atlaspack/optimizer-svgo Patch
@atlaspack/optimizer-swc Patch
@atlaspack/optimizer-terser Patch
@atlaspack/packager-css Patch
@atlaspack/packager-html Patch
@atlaspack/packager-raw-url Patch
@atlaspack/packager-svg Patch
@atlaspack/packager-webextension Patch
@atlaspack/packager-xml Patch
@atlaspack/reporter-build-metrics Patch
@atlaspack/reporter-bundle-analyzer Patch
@atlaspack/reporter-cli Patch
@atlaspack/reporter-dev-server-sw Patch
@atlaspack/reporter-dev-server Patch
@atlaspack/reporter-json Patch
@atlaspack/reporter-lsp Patch
@atlaspack/reporter-sourcemap-visualiser Patch
@atlaspack/reporter-tracer Patch
@atlaspack/resolver-glob Patch
@atlaspack/runtime-browser-hmr Patch
@atlaspack/runtime-js Patch
@atlaspack/runtime-react-refresh Patch
@atlaspack/runtime-service-worker Patch
@atlaspack/runtime-webextension Patch
@atlaspack/transformer-babel Patch
@atlaspack/transformer-css Patch
@atlaspack/transformer-posthtml Patch
@atlaspack/transformer-react-refresh-wrap Patch
@atlaspack/transformer-typescript-types Patch
@atlaspack/transformer-webextension Patch
@atlaspack/transformer-webmanifest Patch
@atlaspack/validator-eslint Patch
@atlaspack/validator-typescript Patch
@atlaspack/resolver-default Patch
@atlaspack/resolver-tesseract Patch
@atlaspack/types Patch
@atlaspack/packager-ts Patch
@atlaspack/transformer-jsonld Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

This comment was marked as outdated.

@github-actions

This comment was marked as outdated.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 17, 2025

📊 Type Coverage Report

Coverage Comparison

Metric Baseline Current Change
Coverage Percentage 92.03% 92.03% ➡️ 0.00%
Correctly Typed 201,335 201,351 +16
Total Expressions 218,749 218,765 +16
Untyped Expressions 17,414 17,414 +0

Files with Most Type Issues (Top 15)

File Issues Affected Lines
packages/core/integration-tests/test/javascript.ts 983 648
packages/core/integration-tests/test/cache.ts 885 626
packages/core/integration-tests/test/scope-hoisting.ts 623 490
packages/utils/node-resolver-core/test/resolver.ts 476 177
packages/core/integration-tests/test/html.ts 468 294
packages/core/integration-tests/test/sourcemaps.ts 356 176
packages/core/test-utils/src/utils.ts 330 205
packages/core/integration-tests/test/incremental-bundling.ts 298 206
packages/core/core/src/dumpGraphToGraphViz.ts 251 108
packages/core/integration-tests/test/output-formats.ts 227 161
packages/transformers/webextension/src/WebExtensionTransformer.ts 210 80
packages/core/integration-tests/test/react-refresh.ts 197 71
packages/core/integration-tests/test/css-modules.ts 191 107
packages/core/core/src/requests/TargetRequest.ts 190 133
packages/core/integration-tests/test/babel.ts 187 115

This report was generated by the Type Coverage GitHub Action

@github-actions
Copy link
Contributor

github-actions bot commented Nov 17, 2025

📊 Benchmark Results

No significant performance changes detected.

📊 Benchmark Results

Overall Performance

Test Duration JS Memory Peak Native Memory Peak vs Baseline Status
Three.js Real Repository (JS) 16.74s 2.00GB 2.07GB N/A ⚪ New
Three.js Real Repository (Native) 24.88s 3.07GB 3.34GB N/A ⚪ New

🔍 Detailed Phase Analysis

Three.js Real Repository (JS)

Phase Duration (avg) Duration (p95) Memory Peak (avg) Memory Peak (p95)
resolving 9.06s 9.15s 1.35GB 1.50GB
transforming 9.05s 9.14s 1.35GB 1.50GB
bundling 8.84s 8.94s 1.35GB 1.50GB
bundled 8.42s 8.51s 1.45GB 1.59GB
packaging 6.25s 6.32s 1.59GB 1.68GB
optimizing 6.08s 6.14s 2.00GB 2.05GB

Three.js Real Repository (Native)

Phase Duration (avg) Duration (p95) Memory Peak (avg) Memory Peak (p95)
bundling 15.03s 19.67s 2.29GB 2.50GB
bundled 14.59s 19.22s 2.46GB 2.70GB
packaging 7.92s 8.57s 2.67GB 3.00GB
optimizing 7.74s 8.39s 3.07GB 3.34GB

💾 Unified Memory Analysis

Three.js Real Repository (JS) Memory Statistics

Memory Type Metric Min Mean Median P95 P99 Max Std Dev
JavaScript RSS 1.54GB 1.79GB 1.96GB 2.05GB 2.05GB 2.05GB 221.72MB
Heap Used 80.00MB 83.88MB 80.91MB 91.48MB 91.48MB 91.48MB 4.73MB
Heap Total 94.35MB 122.64MB 126.87MB 171.85MB 171.85MB 171.85MB 26.84MB
External 38.95MB 94.86MB 106.02MB 173.09MB 173.09MB 173.09MB 60.18MB
Native (Rust) Physical Memory 1.44GB 1.63GB 1.64GB 1.87GB 2.00GB 2.07GB 135.09MB
Virtual Memory 30.19GB 30.89GB 30.89GB 31.14GB 31.32GB 31.40GB 198.37MB

Sample Counts: JS: 6, Native: 267

Three.js Real Repository (Native) Memory Statistics

Memory Type Metric Min Mean Median P95 P99 Max Std Dev
JavaScript RSS 2.30GB 2.81GB 2.82GB 3.34GB 3.34GB 3.34GB 345.33MB
Heap Used 76.90MB 78.73MB 77.31MB 86.42MB 86.42MB 86.42MB 3.45MB
Heap Total 88.70MB 102.02MB 99.20MB 137.64MB 137.64MB 137.64MB 16.57MB
External 45.91MB 159.21MB 179.56MB 185.35MB 185.35MB 185.35MB 50.73MB
Native (Rust) Physical Memory 2.35GB 2.73GB 2.73GB 3.16GB 3.30GB 3.34GB 247.94MB
Virtual Memory 30.67GB 33.35GB 33.40GB 33.84GB 33.96GB 34.04GB 492.67MB

Sample Counts: JS: 6, Native: 578

🖥️ Environment

  • Node.js: v22.17.0
  • Platform: linux (x64)
  • CPU: AMD EPYC 7763 64-Core Processor
  • Total Memory: 15.62GB
  • Git SHA: 6724864
  • Branch: oscar/js-transformer/native-dead-code-elim
  • Timestamp: 2025-11-20T00:08:18.724Z

@OscarCookeAbbott OscarCookeAbbott marked this pull request as ready for review November 17, 2025 04:50
@OscarCookeAbbott OscarCookeAbbott requested a review from a team as a code owner November 17, 2025 04:50
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.

3 participants