Skip to content

Bail early on Cache.set when possible - #2081

Open
kitten wants to merge 1 commit into
react:mainfrom
kitten:@kitten/perf/promise-alloc-cache-write
Open

kitten wants to merge 1 commit into
react:mainfrom
kitten:@kitten/perf/promise-alloc-cache-write

Conversation

@kitten

@kitten kitten commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

We should match the for-loop's condition and bail early on Cache.set without passing through Promise.allSettled when possible. This doesn't change behaviour but avoids allocations.

Changelog: [Internal]

Note

This isn't addressed in this PR, but I've seen that the logger here may add some overhead, even if it's disabled. We assemble lots of small event records, let createEntry and createActionEndEntry() be called, and copy this, and run key.toString('hex') even if the logger is inactive.

Test plan

n/a

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 19, 2026
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Oct 19, 2026

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

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant