Skip to content

feat: add experimental OXC JS fast path#938

Open
sonofmagic wants to merge 32 commits into
mainfrom
codex/rust-oxc-fast-path
Open

feat: add experimental OXC JS fast path#938
sonofmagic wants to merge 32 commits into
mainfrom
codex/rust-oxc-fast-path

Conversation

@sonofmagic

Copy link
Copy Markdown
Owner

No description provided.

@changeset-bot

changeset-bot Bot commented Jun 18, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f90492f

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

This PR includes changesets to release 3 packages
Name Type
weapp-tailwindcss Patch
@weapp-tailwindcss/build-all Patch
@weapp-tailwindcss/website 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

@sonofmagic

Copy link
Copy Markdown
Owner Author

追加一轮性能优化:

  • commit: 5d7d18f perf: skip runtime signature parsing without text hints
  • Vite runtime-affecting JS signature 在源码没有字符串、模板、注释 hint,且不是明显不完整表达式时,直接返回空签名,跳过 Babel parse/traverse。
  • 这个路径作用在 bundle snapshot 阶段,会影响 build/HMR 的重复 JS chunk 扫描成本和 AST 内存峰值。

本地 micro benchmark(无运行时文本的 JS chunk,1000 次):

  • 旧 Babel 签名:3892.18ms,RSS +221MB
  • 新 precheck:24.32ms,RSS +0MB
  • 该场景约 160x 更快,并避免 AST 内存增长。

本地 Vite 小样本:

  • bench:vite-perf -- --mode optimized --runs 2 --warmup 1 --timeout 120000
    • startup: 2843ms, 3028ms
    • hot build: 3541.53ms, 3331.86ms
    • cold build: 3372.16ms, 3436.25ms
  • bench:vite-dev-hmr -- --mode optimized --runs 2 --warmup 1 --timeout 120000 --force-polling true
    • startup: 4029ms, 4315ms
    • HMR: 2419.72ms, 2522.77ms

新增/复跑验证:

  • vitest run test/bundlers/vite-runtime-affecting-signature.unit.test.ts test/bundlers/vite-bundle-state.unit.test.ts test/bundlers/vite-bundle-state-cache.unit.test.ts --coverage.enabled=false
  • vitest run test/js test/bundlers/vite-plugin.bundle.unit.test.ts test/bundlers/vite-runtime-affecting-signature.unit.test.ts --coverage.enabled=false
  • pnpm --filter weapp-tailwindcss run build:types
  • pnpm --filter weapp-tailwindcss exec tsdown --config tsdown.config.mts
  • pnpm --filter weapp-tailwindcss exec vitest run --coverage.enabled=false -> 203 passed | 3 skipped, 2149 passed | 29 skipped
  • git diff --check

@sonofmagic

sonofmagic commented Jun 18, 2026

Copy link
Copy Markdown
Owner Author

Vite / Webpack / Gulp 内存与性能补充报告

采集时间:2026-06-18。采集分支:codex/rust-oxc-fast-path。采集时开启:WEAPP_TW_HMR_TIMING=1WEAPP_TW_HMR_MEMORY_DEBUG=1

构建器 场景 结果 样本数 进程树 RSS 峰值 RSS 基线 -> 增量 插件 debug RSS 峰值 插件 debug heapUsed 峰值 热更新 / 回滚
Vite demo/uni-app-vite-tailwindcss-v4,完整 watch HMR 通过 84 个进程样本 / 58 个插件样本 1560 MB 506 MB -> +1054 MB 1304 MB 967 MB 504 ms / 779 ms
Webpack demo/taro-webpack-react-tailwindcss-v4--style-only watch HMR 通过 16 个进程样本 / 18 个插件样本 1323 MB 384 MB -> +939 MB 1134 MB 476 MB 5205 ms / 2542 ms
Gulp demo/gulp-tailwindcss-v4,单次构建 通过 15 个插件样本 n/a n/a 479 MB 242 MB n/a

采集命令:

WEAPP_TW_HMR_TIMING=1 WEAPP_TW_HMR_MEMORY_DEBUG=1 \
  pnpm --filter @weapp-tailwindcss/scripts test:watch-hmr -- \
  --case uni-app-vite-tailwindcss-v4 --skip-build --quiet-sass \
  --timeout 240000 --max-plugin-process-ms 5000 \
  --report benchmark/hmr-memory-uni-vite-v4.json

WEAPP_TW_HMR_TIMING=1 WEAPP_TW_HMR_MEMORY_DEBUG=1 \
  pnpm --filter @weapp-tailwindcss/scripts test:watch-hmr -- \
  --case taro-webpack-react-tailwindcss-v4 --style-only --skip-build --quiet-sass \
  --timeout 180000 --max-plugin-process-ms 5000 \
  --report benchmark/hmr-memory-taro-webpack-react-v4-style.json

WEAPP_TW_HMR_TIMING=1 WEAPP_TW_HMR_MEMORY_DEBUG=1 \
  pnpm run build
# cwd: demo/gulp-tailwindcss-v4

补充说明:

  • Vite 的插件内存峰值来自 vite:generateBundle 阶段,共 58 个插件样本。本次报告覆盖小程序 watch、分包变更和 H5 HMR。
  • Webpack 的插件内存峰值来自 webpack:processAssets 阶段,共 18 个插件样本。完整 Taro Webpack 运行已经跑到小程序和分包覆盖,但 H5 阶段耗时过长,不适合作为这次 PR 证据采集继续等待;表格采用已完整通过的 --style-only watch 报告。
  • Gulp 的插件内存峰值来自一次完整通过的构建采样。gulp-tailwindcss-v4 --style-only watch 回归这次没有生成通过报告:mutation 后 runner 没有在 dist/pages/index/index.wxss / dist/app.wxss 找到期望的 .tw-watch-style-gulp-tailwindcss-v4-* marker。Gulp watch 初始构建样本峰值约为 493 MB RSS / 243 MB heapUsed;表格采用干净的构建采样结果:479 MB RSS / 242 MB heapUsed

# Conflicts:
#	packages/weapp-tailwindcss/src/bundlers/webpack/BaseUnifiedPlugin/v5-assets.ts
#	packages/weapp-tailwindcss/src/bundlers/webpack/BaseUnifiedPlugin/v5-assets/helpers.ts
#	packages/weapp-tailwindcss/src/bundlers/webpack/BaseUnifiedPlugin/v5.ts
#	packages/weapp-tailwindcss/test/bundlers/vite-plugin.bundle.unit.test.ts
#	packages/weapp-tailwindcss/test/bundlers/vite-plugin.testkit.ts
#	packages/weapp-tailwindcss/test/ci/workflows.test.ts
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