Skip to content

Add SourceMap Benchmark #58125

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

miguelmarcondesf
Copy link
Contributor

@miguelmarcondesf miguelmarcondesf commented May 2, 2025

Add SourceMap Benchmark

This PR introduces a new benchmark suite for the lib/internal/source_map module to help evaluate and explore the performance characteristics of the SourceMap.

I'm still learning how everything fits together, but this is a first step toward understanding where small improvements could improve performance.

cc @BridgeAR

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/performance
  • @nodejs/tsc

@nodejs-github-bot nodejs-github-bot added the needs-ci PRs that need a full CI run. label May 2, 2025
@miguelmarcondesf miguelmarcondesf force-pushed the performance-improvements-sourcemap branch from 5e438af to 4147ff3 Compare May 2, 2025 20:07
@miguelmarcondesf miguelmarcondesf changed the title Performance improvements sourcemap Add SourceMap Benchmark May 2, 2025
@miguelmarcondesf
Copy link
Contributor Author

Local running with n: 1e5 for all cases:

image

@miguelmarcondesf miguelmarcondesf marked this pull request as ready for review May 3, 2025 21:12
@anonrig
Copy link
Member

anonrig commented May 3, 2025

You need to add a test for these benchmarks. You can find similar ones in test folder.

@miguelmarcondesf
Copy link
Contributor Author

You need to add a test for these benchmarks. You can find similar ones in test folder.

Thank you, just pushed that!

@miguelmarcondesf miguelmarcondesf force-pushed the performance-improvements-sourcemap branch from 5749fce to bc9fbe9 Compare May 6, 2025 16:42
Copy link

codecov bot commented May 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.09%. Comparing base (04cb572) to head (c071304).
Report is 60 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #58125      +/-   ##
==========================================
+ Coverage   90.07%   90.09%   +0.02%     
==========================================
  Files         640      640              
  Lines      188262   188262              
  Branches    36912    36911       -1     
==========================================
+ Hits       169580   169623      +43     
+ Misses      11399    11363      -36     
+ Partials     7283     7276       -7     

see 37 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@geeksilva97 geeksilva97 requested a review from H4ad May 20, 2025 14:16
@miguelmarcondesf miguelmarcondesf force-pushed the performance-improvements-sourcemap branch 2 times, most recently from f1040cd to 421ae12 Compare June 5, 2025 18:55
Copy link
Member

@legendecas legendecas left a comment

Choose a reason for hiding this comment

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

Thank you for the change! Overall LGTM % nits.

@miguelmarcondesf miguelmarcondesf force-pushed the performance-improvements-sourcemap branch from 02b5acc to 7eab302 Compare June 18, 2025 23:50
@legendecas legendecas added request-ci Add this label to start a Jenkins CI on a PR. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. labels Jun 20, 2025
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jun 20, 2025
@nodejs-github-bot
Copy link
Collaborator

@miguelmarcondesf miguelmarcondesf force-pushed the performance-improvements-sourcemap branch from c7232d1 to ac7a40e Compare June 20, 2025 20:30
@geeksilva97 geeksilva97 added the request-ci Add this label to start a Jenkins CI on a PR. label Jun 23, 2025
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jun 23, 2025
@nodejs-github-bot
Copy link
Collaborator

'findOrigin',
'findOrigin-sectioned',
],
n: [1e5],
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
n: [1e5],
n: [1e5],

Is this an arbitrary number, or did you find that this is the curve where benchmark results do not change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So I had some testing for 10 up to 1e8 and it stabilizes around 1e5.

For source-map-cache

source_map/source-map-cache.js n=10 operation="findSourceMap-valid": 22,044.640396803527
source_map/source-map-cache.js n=100 operation="findSourceMap-valid": 114,264.03676559647
source_map/source-map-cache.js n=1000 operation="findSourceMap-valid": 135,848.8002852825
source_map/source-map-cache.js n=10000 operation="findSourceMap-valid": 425,194.9252985665
source_map/source-map-cache.js n=100000 operation="findSourceMap-valid": 661,039.200292227
source_map/source-map-cache.js n=1000000 operation="findSourceMap-valid": 655,766.5874586097
source_map/source-map-cache.js n=10000000 operation="findSourceMap-valid": 686,861.3520220064
source_map/source-map-cache.js n=100000000 operation="findSourceMap-valid": 690,901.4430697807

source_map/source-map-cache.js n=10 operation="findSourceMap-generated-source": 19,123.493785820694
source_map/source-map-cache.js n=100 operation="findSourceMap-generated-source": 222,985.82479111804
source_map/source-map-cache.js n=1000 operation="findSourceMap-generated-source": 1,262,360.0831642824
source_map/source-map-cache.js n=10000 operation="findSourceMap-generated-source": 3,751,348.609825232
source_map/source-map-cache.js n=100000 operation="findSourceMap-generated-source": 4,789,673.464011591
source_map/source-map-cache.js n=1000000 operation="findSourceMap-generated-source": 5,322,983.097883862
source_map/source-map-cache.js n=10000000 operation="findSourceMap-generated-source": 3,526,343.638308575
source_map/source-map-cache.js n=100000000 operation="findSourceMap-generated-source": 5,725,883.259174296

For source-map

source_map/source-map.js n=10 operation="parse": 24,502.29709035222
source_map/source-map.js n=100 operation="parse": 94,723.07236179667
source_map/source-map.js n=1000 operation="parse": 172,707.84309492455
source_map/source-map.js n=10000 operation="parse": 353,478.6719806294
source_map/source-map.js n=100000 operation="parse": 454,661.1017299623
source_map/source-map.js n=1000000 operation="parse": 502,081.0841701146
source_map/source-map.js n=10000000 operation="parse": 503,396.77038754406
source_map/source-map.js n=100000000 operation="parse": 500,985.0726477283
source_map/source-map.js n=10 operation="parse-sectioned": 21,158.42369743454
source_map/source-map.js n=100 operation="parse-sectioned": 28,618.788578127005
source_map/source-map.js n=1000 operation="parse-sectioned": 121,799.59387143419
source_map/source-map.js n=10000 operation="parse-sectioned": 230,234.37859741217
source_map/source-map.js n=100000 operation="parse-sectioned": 310,112.7780007161
source_map/source-map.js n=1000000 operation="parse-sectioned": 335,803.14216158056
source_map/source-map.js n=10000000 operation="parse-sectioned": 323,348.8163390162
source_map/source-map.js n=100000000 operation="parse-sectioned": 318,926.62476153404
source_map/source-map.js n=10 operation="findEntry": 167,364.01673640168
source_map/source-map.js n=100 operation="findEntry": 1,203,615.6614469867
source_map/source-map.js n=1000 operation="findEntry": 2,766,573.156493977
source_map/source-map.js n=10000 operation="findEntry": 6,595,762.22277187
source_map/source-map.js n=100000 operation="findEntry": 34,166,132.82084134
source_map/source-map.js n=1000000 operation="findEntry": 66,372,785.67112444
source_map/source-map.js n=10000000 operation="findEntry": 69,998,661.2756031
source_map/source-map.js n=100000000 operation="findEntry": 74,137,195.965463
source_map/source-map.js n=10 operation="findEntry-sectioned": 157,895.56787140985
source_map/source-map.js n=100 operation="findEntry-sectioned": 1,099,408.518217199
source_map/source-map.js n=1000 operation="findEntry-sectioned": 3,204,265.518257905
source_map/source-map.js n=10000 operation="findEntry-sectioned": 13,917,070.957577985
source_map/source-map.js n=100000 operation="findEntry-sectioned": 32,089,851.58443642
source_map/source-map.js n=1000000 operation="findEntry-sectioned": 62,772,341.727857664
source_map/source-map.js n=10000000 operation="findEntry-sectioned": 68,942,219.52581541
source_map/source-map.js n=100000000 operation="findEntry-sectioned": 66,538,906.42142866
source_map/source-map.js n=10 operation="findOrigin": 129,379.49593748382
source_map/source-map.js n=100 operation="findOrigin": 902,934.5372460497
source_map/source-map.js n=1000 operation="findOrigin": 2,388,293.540382461
source_map/source-map.js n=10000 operation="findOrigin": 12,155,586.646844957
source_map/source-map.js n=100000 operation="findOrigin": 30,224,035.664362084
source_map/source-map.js n=1000000 operation="findOrigin": 54,367,277.162258655
source_map/source-map.js n=10000000 operation="findOrigin": 61,682,814.88834895
source_map/source-map.js n=100000000 operation="findOrigin": 65,709,915.70638048
source_map/source-map.js n=10 operation="findOrigin-sectioned": 133,184.16706621918
source_map/source-map.js n=100 operation="findOrigin-sectioned": 766,530.2242867437
source_map/source-map.js n=1000 operation="findOrigin-sectioned": 2,399,042.3023129166
source_map/source-map.js n=10000 operation="findOrigin-sectioned": 5,187,171.295438972
source_map/source-map.js n=100000 operation="findOrigin-sectioned": 16,531,884.963870391
source_map/source-map.js n=1000000 operation="findOrigin-sectioned": 50,945,463.747131586
source_map/source-map.js n=10000000 operation="findOrigin-sectioned": 41,329,287.598349184
source_map/source-map.js n=100000000 operation="findOrigin-sectioned": 60,279,529.754421346

@miguelmarcondesf miguelmarcondesf force-pushed the performance-improvements-sourcemap branch from ac7a40e to c071304 Compare June 23, 2025 20:37
@RafaelGSS RafaelGSS added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue Add this label to land a pull request using GitHub Actions. labels Jul 1, 2025
@nodejs-github-bot nodejs-github-bot added commit-queue-failed An error occurred while landing this pull request using GitHub Actions. and removed commit-queue Add this label to land a pull request using GitHub Actions. labels Jul 1, 2025
@nodejs-github-bot
Copy link
Collaborator

Commit Queue failed
- Loading data for nodejs/node/pull/58125
✔  Done loading data for nodejs/node/pull/58125
----------------------------------- PR info ------------------------------------
Title      Add SourceMap Benchmark (#58125)
Author     Miguel Marcondes Filho <[email protected]> (@miguelmarcondesf)
Branch     miguelmarcondesf:performance-improvements-sourcemap -> nodejs:main
Labels     author ready, needs-ci, commit-queue-squash
Commits    3
 - benchmark: add source map and source map cache
 - benchmark: use fixtures for sourcemap cache
 - benchmark: use fixtures and avoid dead code for sourcemap
Committers 1
 - Miguel Marcondes <[email protected]>
PR-URL: https://github.com/nodejs/node/pull/58125
Reviewed-By: Chengzhong Wu <[email protected]>
Reviewed-By: Edy Silva <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Rafael Gonzaga <[email protected]>
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/58125
Reviewed-By: Chengzhong Wu <[email protected]>
Reviewed-By: Edy Silva <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Rafael Gonzaga <[email protected]>
--------------------------------------------------------------------------------
   ℹ  This PR was created on Fri, 02 May 2025 17:48:50 GMT
   ✔  Approvals: 4
   ✔  - Chengzhong Wu (@legendecas) (TSC): https://github.com/nodejs/node/pull/58125#pullrequestreview-2946108239
   ✔  - Edy Silva (@geeksilva97): https://github.com/nodejs/node/pull/58125#pullrequestreview-2950130654
   ✔  - James M Snell (@jasnell) (TSC): https://github.com/nodejs/node/pull/58125#pullrequestreview-2952013937
   ✔  - Rafael Gonzaga (@RafaelGSS) (TSC): https://github.com/nodejs/node/pull/58125#pullrequestreview-2975274650
   ✔  Last GitHub CI successful
   ℹ  Last Full PR CI on 2025-06-23T13:44:33Z: https://ci.nodejs.org/job/node-test-pull-request/67620/
   ⚠  Commits were pushed after the last Full PR CI run:
   ⚠  - benchmark: add source map and source map cache
   ⚠  - benchmark: use fixtures for sourcemap cache
   ⚠  - benchmark: use fixtures and avoid dead code for sourcemap
- Querying data for job/node-test-pull-request/67620/
   ✔  Last Jenkins CI successful
--------------------------------------------------------------------------------
   ✔  Aborted `git node land` session in /home/runner/work/node/node/.ncu
https://github.com/nodejs/node/actions/runs/15999945215

@geeksilva97 geeksilva97 added request-ci Add this label to start a Jenkins CI on a PR. and removed commit-queue-failed An error occurred while landing this pull request using GitHub Actions. labels Jul 1, 2025
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jul 1, 2025
@nodejs-github-bot
Copy link
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. needs-ci PRs that need a full CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants