esm: skip percent-decode copy for unescaped data URLs #67684
Review requested:
Welcome to Node.js, and thank you for your first contribution!
Before review, please take a moment to read:
the guide for first-time contributors
the contribution and automation policies
the pull request guide
the AI use policy
* the Code of Conduct
Please make sure every commit is signed off. For a first pull request, GitHub Actions require collaborator approval and Jenkins CI must be started by a collaborator or triager, so an initial wait is normal.
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 90.60%. Comparing base (
db671bb) to head (254ebd9).:warning: Report is 172 commits behind head on main.
<details><summary>Additional details and impacted files</summary>
@@ Coverage Diff @@
## main #67684 +/- ##
==========================================
- Coverage 90.71% 90.60% -0.12%
==========================================
Files 801 801
Lines 280917 281107 +190
Branches 54237 54269 +32
==========================================
- Hits 254832 254691 -141
- Misses 16253 16601 +348
+ Partials 9832 9815 -17
| Files with missing lines | Coverage Δ | |
|---|---|---|
| lib/internal/data\_url.js | 100.00% <100.00%> (ø) | |
... and 69 files with indirect coverage changes
</details>
<details><summary> :rocket: New features to boost your workflow: </summary>
</details>
Approved these changes.
lgtm
nice!
@gurgunday @jasnell hey 👋
I believe this PR is ready to merge. Could you add the commit-queue label?
Landed in da97d87f9ab4fe48518a7dac9db7efccd36e2e76
jasnell
ychuhai
Decoding a
data:URL body copied every byte into a second array, even when there was nothing to decode. Skip when there's nothing, and take the index when there is a percent and use that to start the encoding.benchmark/esm/data-url-processor.js(30 runs):| size |
plain|base64||---|---|---|
| 64 | +30.23 % | +18.97 % |
| 1024 | +146.98 % | +27.66 % |
| 16384 | +1029.18 % | +24.37 % |
| 65536 | +1125.72 % | +27.25 % |
| size |
percent|percent-tail|percent-mid|percent-at-64||---|---|---|---|---|
| 64 | −2.02 % | −1.13 % | +4.29 % | +3.84 % |
| 1024 | +6.32 % | +113.54 % | +36.46 % | +6.23 % |
| 16384 | +11.23 % | +804.23 % | +83.44 % | +11.17 % |
| 65536 | +15.25 % | +968.96 % | +87.65 % ** | +7.13 % |