Repository navigation
Commit fc68c44
authored
perf(javascript): print a mangled program once, naming it afterwards (#22504)
* perf(javascript): print a mangled program once, naming it afterwards
The mangle phase printed the tree twice: once to count the characters
the names are chosen from, once for the result. It now prints before
the names are chosen, recording where each name and each import or
export `as` clause lies, counts the characters off that text and writes
the names into it once chosen, moving the source map's columns with
them. The `let` declarations the improve phase left for after naming
are written before that print, and the count puts back what they
changed. A print that wrote a comment, shebang or preamble still counts
with a print of its own, as those are not counted.
* test(javascript): fit two minifier tests to #22473 and #22499 together
#22473 counts a conversion as code that may run, so the value
#22499's improved case moved past `console` now has effects and
stays put; it now moves a comparison, which converts nothing. And
#22499 now shortens #22473's literal case, whose assertion holds the
output to terser's, so that case runs with the improve phase off.
With both in, `vercel/ms` is bigger than oxc's output again (787
against 781 gzip), so it goes back on OXC_SMALLER, where #22499 had
retired it on its own. And #22502 leaves terser's
`side_effects_cascade_3` no bigger than oxc's, so it comes off.
Claude-Session: https://claude.ai/code/session_01ViD41i2KdwwGxrDk7yrjeD1 parent 79aa5df commit fc68c44
4 files changed
Lines changed: 603 additions & 82 deletions
File tree
- lib/javascript
- test/unitCases
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1691 | 1691 | | |
1692 | 1692 | | |
1693 | 1693 | | |
| 1694 | + | |
1694 | 1695 | | |
1695 | 1696 | | |
1696 | 1697 | | |
| |||
1835 | 1836 | | |
1836 | 1837 | | |
1837 | 1838 | | |
| 1839 | + | |
| 1840 | + | |
1838 | 1841 | | |
1839 | 1842 | | |
1840 | 1843 | | |
| |||
2344 | 2347 | | |
2345 | 2348 | | |
2346 | 2349 | | |
2347 | | - | |
| 2350 | + | |
| 2351 | + | |
| 2352 | + | |
| 2353 | + | |
| 2354 | + | |
2348 | 2355 | | |
2349 | 2356 | | |
2350 | 2357 | | |
| |||
2519 | 2526 | | |
2520 | 2527 | | |
2521 | 2528 | | |
| 2529 | + | |
2522 | 2530 | | |
2523 | 2531 | | |
2524 | 2532 | | |
| |||
2540 | 2548 | | |
2541 | 2549 | | |
2542 | 2550 | | |
| 2551 | + | |
| 2552 | + | |
| 2553 | + | |
2543 | 2554 | | |
2544 | 2555 | | |
2545 | 2556 | | |
2546 | 2557 | | |
2547 | 2558 | | |
2548 | | - | |
2549 | 2559 | | |
2550 | 2560 | | |
2551 | 2561 | | |
| |||
2555 | 2565 | | |
2556 | 2566 | | |
2557 | 2567 | | |
| 2568 | + | |
| 2569 | + | |
| 2570 | + | |
2558 | 2571 | | |
2559 | 2572 | | |
2560 | 2573 | | |
2561 | 2574 | | |
2562 | | - | |
2563 | 2575 | | |
2564 | 2576 | | |
2565 | 2577 | | |
| |||
2762 | 2774 | | |
2763 | 2775 | | |
2764 | 2776 | | |
2765 | | - | |
| 2777 | + | |
| 2778 | + | |
2766 | 2779 | | |
2767 | 2780 | | |
2768 | 2781 | | |
| |||
0 commit comments