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

Reduce error allocations #446

Merged
merged 2 commits into from
Jul 5, 2024
Merged

Reduce error allocations #446

merged 2 commits into from
Jul 5, 2024

Conversation

glbrntt
Copy link
Contributor

@glbrntt glbrntt commented Jul 5, 2024

Motivation:

Existential errors are unconditionally boxed. We typically create and use errors to fail promises when performing cleanup work. One example of this is failing pending writes when a stream channel is closed, however this is done unconditionally which means every stream channel incurs an allocation when it closes.

Modifications:

  • Statically create some existential errors ahead of time

Result:

Fewer allocations

glbrntt added 2 commits July 5, 2024 08:50
Motivation:

Existential errors are unconditionally boxed. We typically create and
use errors to fail promises when performing cleanup work. One example
of this is failing pending writes when a stream channel is closed,
however this is done unconditionally which means every stream channel
incurs an allocation when it closes.

Modifications:

- Statically create some existential errors ahead of time

Result:

Fewer allocations
@glbrntt glbrntt marked this pull request as ready for review July 5, 2024 08:38
@glbrntt glbrntt added the 🔨 semver/patch No public API change. label Jul 5, 2024
@glbrntt glbrntt requested a review from FranzBusch July 5, 2024 09:15
@glbrntt glbrntt enabled auto-merge (squash) July 5, 2024 09:15
@glbrntt glbrntt merged commit ed8a315 into apple:main Jul 5, 2024
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 semver/patch No public API change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants