Skip to content
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

assert: improve myers diff performance #57279

Merged

Conversation

puskin94
Copy link
Contributor

@puskin94 puskin94 commented Mar 2, 2025

fix: #57242

I reviewed the codebase and identified both some quick-win optimizations and the primary reason for the performance degradation when generating the error diff.

@Rymar, using the code example you posted in the related issue for testing during the fix, we should achieve performance levels close to what we had with the previous linear algorithm that Node.js used before switching to the Myers algorithm.

/cc @BridgeAR

@nodejs-github-bot nodejs-github-bot added assert Issues and PRs related to the assert subsystem. needs-ci PRs that need a full CI run. labels Mar 2, 2025
Copy link

codecov bot commented Mar 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.23%. Comparing base (fd45383) to head (3a76c93).
Report is 62 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #57279      +/-   ##
==========================================
- Coverage   90.26%   90.23%   -0.03%     
==========================================
  Files         630      630              
  Lines      184634   184912     +278     
  Branches    36137    36180      +43     
==========================================
+ Hits       166654   166852     +198     
- Misses      11022    11063      +41     
- Partials     6958     6997      +39     
Files with missing lines Coverage Δ
lib/internal/assert/myers_diff.js 88.88% <100.00%> (-0.50%) ⬇️

... and 52 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.

@puskin94 puskin94 force-pushed the improve-myers-diff-performance branch from c6f4f0b to 3a76c93 Compare March 3, 2025 07:39
@BridgeAR BridgeAR added needs-benchmark-ci PR that need a benchmark CI run. request-ci Add this label to start a Jenkins CI on a PR. labels Mar 3, 2025
@BridgeAR
Copy link
Member

BridgeAR commented Mar 3, 2025

@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Mar 3, 2025
@nodejs-github-bot
Copy link
Collaborator

@BridgeAR BridgeAR added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Mar 3, 2025
@puskin94
Copy link
Contributor Author

puskin94 commented Mar 3, 2025

                                                               confidence improvement accuracy (*)    (**)   (***)
assert/assertion-error.js datasetName='objects' size=10 n=10          ***    146.69 %      ±11.02% ±14.84% ±19.67%
assert/assertion-error.js datasetName='objects' size=10 n=200         ***    464.19 %       ±4.82%  ±6.49%  ±8.61%
assert/assertion-error.js datasetName='objects' size=10 n=50          ***    314.21 %       ±8.46% ±11.40% ±15.13%
assert/assertion-error.js datasetName='objects' size=10 n=500         ***    530.52 %       ±2.50%  ±3.37%  ±4.47%
assert/assertion-error.js datasetName='objects' size=100 n=10         ***   1137.02 %      ±14.04% ±18.92% ±25.11%
assert/assertion-error.js datasetName='objects' size=100 n=200        ***   1253.63 %      ±29.90% ±40.29% ±53.49%
assert/assertion-error.js datasetName='objects' size=100 n=50         ***   1239.92 %      ±26.41% ±35.60% ±47.26%
assert/assertion-error.js datasetName='objects' size=100 n=500        ***   1289.22 %      ±19.54% ±26.33% ±34.96%

@nodejs-github-bot
Copy link
Collaborator

@BridgeAR BridgeAR added the commit-queue Add this label to land a pull request using GitHub Actions. label Mar 6, 2025
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Mar 6, 2025
@nodejs-github-bot nodejs-github-bot merged commit 395439b into nodejs:main Mar 6, 2025
66 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in 395439b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
assert Issues and PRs related to the assert subsystem. author ready PRs that have at least one approval, no pending requests for changes, and a CI started. needs-benchmark-ci PR that need a benchmark CI run. needs-ci PRs that need a full CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

deepStrictEqual bad performance on larger dataset
4 participants