-
-
Notifications
You must be signed in to change notification settings - Fork 131
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
perf(model/gateway)!: Optimize Event
size
#1436
perf(model/gateway)!: Optimize Event
size
#1436
Conversation
Brings down `Event` size from 712 -> 192 bytes.
Dereference internally, don't expose Box publicly
Could you decide on and document a rule for when we should box events, should future ones be added? |
In this PR I just boxed every variant larger than the already boxed ones and unboxed the ones smaller than I've not benchmarked before, nor can I create an accurate model of incoming |
Event
sizeEvent
size
@7596ff I added the instructions I was talking about and probably didn't break CI. |
Channels The `Channel` type has been unified into a struct ([#1449] - [@zeylahellyer], [@itohatweb]). All possible fields of every channel variant and thread variant are now present on this type. This change was prompted by Discord's own storage of channels, and that variants do not necessarily have guaranteed fields. See the PR description for more details. New `http` module Add a new module, `http` ([#1508], [#1521] - [@7596ff]). This module contains types that are only sent to Discord. `AttachmentFile` has been moved from `twilight-http` and renamed to `model::http::attachment::Attachment`. `InteractionResponse` has been moved to `model::http::interaction::InteractionResponse`. `CallbackData` has been renamed to `InteractionResponseData`. `PermissionOverwrite` now has a separate type in `model::http`; it differs from a received `PermissionOverwrite` in that its `allow` and `deny` fields are optional. Additions Add support for modals ([#1300] - [@itohatweb], [@7596ff]): - Sending - add a new component, `TextInput` - move `Component` de/serialization to the enum itself, and remove all de/serialization from its variants - Receiving - add `Interaction::Modal`, `InteractionType::ModalSubmit` - add `ModalSubmitInteraction`, `ModalInteractionData`, `ModalInteractionDataActionRow`, `ModalInteractionDataComponent` Add `GuildStickersUpdate` to the `Event` enum ([#1520] - [@HTG-YT]). Changes `Event` variants have been boxed or unboxed based on a new threshold, making the size of the enum more consistent ([#1436] - [@vilgotf]). Rename `Intents::GUILD_EMOJIS` to `GUILD_EMOJIS_AND_STICKERS` ([#1520] - [@HTG-YT]). `PermissionOverwrite` has been refactored to more closely represent Discord's model ([#1521] - [@7596ff]). Its ID is stored with a generic marker, and can be casted to a member or role ID as needed. Update to Discord API version 10 ([#1540] - [@zeylahellyer]). This involves two changes: - remove `CurrentApplicationInfo`'s `summary` field - add `Intents::MESSAGE_CONTENT` [#1300]: #1300 [#1436]: #1436 [#1449]: #1449 [#1508]: #1508 [#1520]: #1520 [#1521]: #1521 [#1540]: #1540 [@7596ff]: https://github.com/7596ff [@HTG-YT]: https://github.com/HTG-YT [@itohatweb]: https://github.com/itohatweb [@vilgotf]: https://github.com/vilgotf [@zeylahellyer]: https://github.com/zeylahellyer
Event
and variant sizesEvent
variantsEvent
variantsFrom<DispatchEvent>