Latest Results
feat(es/minifier): Account for shorthand expansion when inlining (#12428)
**Description:**
I found this while reducing Seroval's client bundle size in TanStack
Start. Splitting the node factory into separate leaf and full-node
helpers saved 17 gzip bytes with esbuild, but added 90-101 gzip bytes in
the Rsbuild apps.
The full-node helper returns `{ t, i, s, c, m, p, e, a, f, b, o, l }`.
SWC counts that as 25 bytes, which puts it under the inlining budget for
a twelve-parameter function. Once the parameters are substituted, the
shorthand properties become explicit key/value pairs, often with `void
0` values. The shared object literal ended up copied into 19 call sites.
This adds two bytes per shorthand property to the cost used for
repeated-function inlining: a colon and a minimum one-character value.
The shared size estimator stays unchanged, as do the single-use inlining
path and the cost of scalar expressions. It's a conservative estimate,
not a full calculation of every call site's arguments.
For the captured Start RPC input, using SWC's Rust minifier example at
`965c2dfe2` before and after this change:
| | Before | After |
| --- | ---: | ---: |
| Raw bytes | 24,076 | 23,059 |
| Gzip bytes | 8,072 | 7,966 |
| Brotli bytes | 7,294 | 7,220 |
| Full-object copies | 19 | 1 |
These are standalone minifier results, not rebuilt application sizes.
The smaller reduced case saves 322 raw bytes but adds 24 gzip bytes and
16 Brotli bytes, so this is not a compressed-size win for every input.
**Related issue (if exists):**
Related to swc-project/swc#5404 and swc-project/swc#10929. Neither
describes this exact object-factory case.
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: DongYun Kang <kdy.1997.dev@gmail.com> Latest Branches
0%
codex/preserve-changeset-changelog 0%
LadyBluenotes:fix/object-factory-inline-cost 0%
Kaus1ubh:fix/in-operator-side-effect-11246 © 2026 CodSpeed Technology