Skip to content

Solve low hanging fruit causing large future sizes#3357

Merged
GnomedDev merged 1 commit intoserenity-rs:nextfrom
GnomedDev:opt-future-sizes
May 19, 2025
Merged

Solve low hanging fruit causing large future sizes#3357
GnomedDev merged 1 commit intoserenity-rs:nextfrom
GnomedDev:opt-future-sizes

Conversation

@GnomedDev
Copy link
Member

See #3356.

This PR also removes CreateMessage::reactions as this brought my attention to it and it is bloating future sizes for all users while not following discord's API.

@github-actions github-actions bot added model Related to the `model` module. builder Related to the `builder` module. http Related to the `http` module. labels Apr 27, 2025
Comment on lines +78 to +84
// Build the multipart first, as to keep future size small.
let multipart = if let Some(multipart) = self.multipart {
Some(multipart.build_form().await?)
} else {
None
};

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused here. The function call doesn't capture any locals, so why would it matter when it gets awaited? Or does it capture all of self?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function call doesn't use any of the locals, but the state machine for Request::build still needs to store the locals. By moving this back, we don't have to store the path/builder/headers in the state machine as there are no awaits after this.

@arqunis arqunis added enhancement An improvement to Serenity. breaking change The public API is changed, resulting in miscompilations or unexpected new behaviour for users labels May 19, 2025
@GnomedDev GnomedDev merged commit 956f5f1 into serenity-rs:next May 19, 2025
23 of 24 checks passed
@GnomedDev GnomedDev deleted the opt-future-sizes branch May 19, 2025 16:47
mkrasnitski pushed a commit to mkrasnitski/serenity that referenced this pull request Jun 30, 2025
mkrasnitski pushed a commit to mkrasnitski/serenity that referenced this pull request Jun 30, 2025
mkrasnitski pushed a commit to mkrasnitski/serenity that referenced this pull request Jun 30, 2025
mkrasnitski pushed a commit to mkrasnitski/serenity that referenced this pull request Jul 28, 2025
mkrasnitski pushed a commit to mkrasnitski/serenity that referenced this pull request Jul 28, 2025
mkrasnitski pushed a commit to mkrasnitski/serenity that referenced this pull request Oct 7, 2025
mkrasnitski pushed a commit to mkrasnitski/serenity that referenced this pull request Oct 7, 2025
mkrasnitski pushed a commit to mkrasnitski/serenity that referenced this pull request Oct 7, 2025
arqunis pushed a commit to arqunis/serenity that referenced this pull request Jan 22, 2026
arqunis pushed a commit to arqunis/serenity that referenced this pull request Feb 27, 2026
arqunis pushed a commit to arqunis/serenity that referenced this pull request Mar 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change The public API is changed, resulting in miscompilations or unexpected new behaviour for users builder Related to the `builder` module. enhancement An improvement to Serenity. http Related to the `http` module. model Related to the `model` module.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants