Skip to content

perf: pass native promises to Promise.all in ResultAsync.combine - #693

Open
hood wants to merge 1 commit into
supermacro:masterfrom
hood:perf/async-combine
Open

hood wants to merge 1 commit into
supermacro:masterfrom
hood:perf/async-combine

Conversation

@hood

@hood hood commented Nov 5, 2026

Copy link
Copy Markdown

Summary

ResultAsync.combine / combineWithAllErrors now hand the underlying native promises to Promise.all instead of the ResultAsync thenables, and combine with a single .then instead of fromSafePromise(...).andThen(...). _promise stays private: it is read from within ResultAsync's static methods, and the internal helpers now take a list of promises.

Closes #692

Results

Node 26, median of 5 runs, esbuild CJS bundle of src/.

Benchmark Before After Gain
ResultAsync.combine of 10k, time 2.22ms 1.19ms 1.9x
ResultAsync.combine of 10k, ticks to settle 6 3 2x

No public API change. All 117 tests, tsc, test types and lint pass.

@changeset-bot

changeset-bot Bot commented Nov 5, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 91a7829

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
neverthrow Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

This branch has not been deployed

No deployments
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.

ResultAsync.combine passes thenables to Promise.all

1 participant