Skip to content

perf(jsx): cache TypeScript Babel plugin config#799

Merged
sapphi-red merged 3 commits into
vitejs:mainfrom
TheAlexLichter:perf/optimize-vue-jsx-transform
Jun 23, 2026
Merged

perf(jsx): cache TypeScript Babel plugin config#799
sapphi-red merged 3 commits into
vitejs:mainfrom
TheAlexLichter:perf/optimize-vue-jsx-transform

Conversation

@TheAlexLichter

@TheAlexLichter TheAlexLichter commented Jun 21, 2026

Copy link
Copy Markdown
Member

Summary

This PR caches Babel TypeScript plugin ConfigItems per Vue JSX plugin instance, avoiding repeated plugin initialization across TSX transforms.

Performance

Measured with Node 24.17.0 using 18 distinct module IDs, 3 warmup batches, and 20 measured batches per process.

Representative TSX input:

mode before after change
production client 8.85 ms 6.25 ms -29%
production SSR 7.36 ms 5.45 ms -26%
serve client 7.51 ms 5.61 ms -25%

18 copies of Nuxt's small TSX fixture:

mode before after change
production client 3.81 ms 2.76 ms -28%
production SSR 3.86 ms 2.77 ms -28%
serve client 3.96 ms 2.88 ms -27%

@pkg-pr-new

pkg-pr-new Bot commented Jun 21, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@vitejs/plugin-vue@799
npm i https://pkg.pr.new/@vitejs/plugin-vue-jsx@799

commit: 724f46b

@TheAlexLichter TheAlexLichter marked this pull request as draft June 21, 2026 12:14
@TheAlexLichter TheAlexLichter marked this pull request as ready for review June 21, 2026 12:28

@sapphi-red sapphi-red left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I've removed the tests as I thought it relied on the internals too much. I hope you don't mind.

@sapphi-red sapphi-red merged commit 5f3ffab into vitejs:main Jun 23, 2026
11 checks passed
@TheAlexLichter

Copy link
Copy Markdown
Member Author

Not minding this at all! I also felt it was a bit too coupled but didn't find a better way

@TheAlexLichter TheAlexLichter deleted the perf/optimize-vue-jsx-transform branch June 23, 2026 10:45
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.

2 participants