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

Optimize contexts #490

Merged
merged 7 commits into from
Nov 10, 2024
Merged

Optimize contexts #490

merged 7 commits into from
Nov 10, 2024

Conversation

timcassell
Copy link
Owner

@timcassell timcassell commented Nov 10, 2024

  • Promise(<T>).ConfigureAwait(ContinuationOptions) consumes no memory if Promise.Config.AsyncFlowExecutionContextEnabled is disabled.
  • Unioned together some fields to reduce size of async Promise(<T>), async synchronization primitive promises, and Promise.ParallelFor*.

develop:

Type Pending Allocated Survived
AsyncAwait True - 648 B
ContinueWith True - 336 B

PR:

Type Pending Allocated Survived
AsyncAwait True - 624 B
ContinueWith True - 336 B

Re-used `ContinuationContext` field in `AsyncSynchronizationPromiseBase<TResult>` to reduce memory.
… `PromiseParallelForEachAsync<>` to reduce memory.
@timcassell timcassell added this to the v3.3.0 milestone Nov 10, 2024
@timcassell timcassell self-assigned this Nov 10, 2024
@timcassell timcassell merged commit 3292c95 into develop Nov 10, 2024
27 checks passed
@timcassell timcassell deleted the optimize-configureawait branch November 10, 2024 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant