Skip to content

Some optimizations for Promise handling#6645

Open
jasnell wants to merge 1 commit intomainfrom
jasnell/promise-short-circuit
Open

Some optimizations for Promise handling#6645
jasnell wants to merge 1 commit intomainfrom
jasnell/promise-short-circuit

Conversation

@jasnell
Copy link
Copy Markdown
Collaborator

@jasnell jasnell commented Apr 23, 2026

Add some some-circuiting behavior when promises are already rejected or resolved to undefined (when possible).

We can't completely optimize every case because of silly timing differences that are introduced but this gets us at least part of the way.

@jasnell jasnell requested review from a team as code owners April 23, 2026 16:32
ask-bonk[bot]

This comment was marked as resolved.

@ask-bonk

This comment was marked as resolved.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 23, 2026

Merging this PR will not alter performance

✅ 72 untouched benchmarks
⏩ 129 skipped benchmarks1


Comparing jasnell/promise-short-circuit (df1336a) with main (b322726)2

Open in CodSpeed

Footnotes

  1. 129 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

  2. No successful run was found on main (9e6e5cb) during the generation of this report, so b322726 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 23, 2026

Codecov Report

❌ Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.44%. Comparing base (46d402b) to head (df1336a).
⚠️ Report is 17 commits behind head on main.

Files with missing lines Patch % Lines
src/workerd/jsg/promise.h 0.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6645      +/-   ##
==========================================
- Coverage   66.48%   66.44%   -0.05%     
==========================================
  Files         405      405              
  Lines      117783   116102    -1681     
  Branches    19425    19431       +6     
==========================================
- Hits        78306    77141    -1165     
+ Misses      27895    27380     -515     
+ Partials    11582    11581       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 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.

Add some some-circuiting behavior when promises are
already rejected or resolved to undefined (when possible).
@jasnell jasnell force-pushed the jasnell/promise-short-circuit branch from 1428c91 to df1336a Compare April 23, 2026 17:12
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