Skip to content

feat: experimental.nativeMagicString - #9

Closed
IWANABETHATGUY wants to merge 2 commits into
mainfrom
background-sourcemap-gen
Closed

IWANABETHATGUY wants to merge 2 commits into
mainfrom
background-sourcemap-gen

Conversation

@IWANABETHATGUY

Copy link
Copy Markdown
Member

No description provided.

feat: 🎸 update

chore: 🤖 update

chore: 🤖 update
@IWANABETHATGUY
IWANABETHATGUY force-pushed the background-sourcemap-gen branch from fcb7329 to 6097d49 Compare October 5, 2025 17:13
@IWANABETHATGUY IWANABETHATGUY changed the title feate: Background sourcemap gen feat: Background sourcemap gen Oct 26, 2025
@IWANABETHATGUY IWANABETHATGUY changed the title feat: Background sourcemap gen feat: experimental.nativeMagicString Oct 26, 2025
@Boshen Boshen closed this Nov 11, 2025
hyfdev pushed a commit to rolldown/rolldown that referenced this pull request Nov 20, 2026
…tring` (#11107)

`getCombinedSourcemap` left out the maps of earlier transform hooks that returned a native MagicString when `experimental.nativeMagicString` and sourcemaps were enabled, because those maps were only added to the sourcemap chain after the scan stage.

When a hook calls `getCombinedSourcemap`, the earlier hooks' maps are now generated on the JS thread instead of in the background, which is still no more work than without `nativeMagicString`.

<details>
<summary>Benchmarks</summary>

Release builds of this PR vs its parent (a745574) on an Apple M3 Pro. Each cell is the median build time of 30 (threejs10x) or 15 (apps) runs, alternating the two builds in random order, with a 95% bootstrap interval for the change. The bundles and sourcemaps are byte-identical between the two builds.

threejs10x, `sourcemap: true`:

| Scenario | parent | PR | Change |
| --- | --- | --- | --- |
| no plugins | 551 ms | 552 ms | +0.2% (-0.7 to +1.1) |
| `nativeMagicString`, 1 MagicString plugin | 575 ms | 572 ms | -0.6% (-1.0 to -0.1) |
| `nativeMagicString`, 3 MagicString plugins | 591 ms | 586 ms | -0.9% (-1.5 to +0.2) |
| `nativeMagicString`, 1 plugin + `getCombinedSourcemap` in every module | 583 ms | 578 ms | -0.9% (-1.6 to -0.3) |
| flag off, 1 plugin | 576 ms | 573 ms | -0.5% (-0.9 to +0.2) |
| flag off, 1 plugin + `getCombinedSourcemap` in every module | 584 ms | 588 ms | +0.6% (-0.1 to +1.2) |

The apps and plugins of rolldown/benchmarks#9, with `nativeMagicString` set explicitly:

| App | Scenario | parent | PR | Change |
| --- | --- | --- | --- | --- |
| 5000 | `oxc+magicString` | 1510 ms | 1505 ms | -0.3% (-0.9 to +0.9) |
| 5000 | `oxc+nativeMagicString` | 1569 ms | 1539 ms | -1.9% (-5.1 to -0.6) |
| 10000 | `oxc+magicString` | 3105 ms | 3108 ms | +0.1% (-0.8 to +0.6) |
| 10000 | `oxc+nativeMagicString` | 3128 ms | 3124 ms | -0.1% (-0.6 to +0.1) |

</details>

close #9459
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