Skip to content

Conversation

@xacrimon
Copy link
Contributor

@xacrimon xacrimon commented Feb 14, 2025

Avoid temporarily deserializing gateway messages to a serde_json::Map<String, Value> before typed deserialization to an Event. Previously, this meant the creation of a serde_json::Value tree, causing creation and immediately after the destruction of upwards of hundreds to thousands of owned strings and btreemaps for every handled gateway event.

@github-actions github-actions bot added model Related to the `model` module. gateway Related to the `gateway` module. labels Feb 14, 2025
@xacrimon xacrimon marked this pull request as ready for review February 14, 2025 20:35
@xacrimon xacrimon force-pushed the skip-intermediate-deser-btreemap-tree branch from e21c4b6 to 5fe2801 Compare February 14, 2025 21:46
Copy link
Collaborator

@mkrasnitski mkrasnitski left a comment

Choose a reason for hiding this comment

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

Overall this is definitely an improvement. It does suck that we're cloning the json data once, but for now we have to defer deserialization of Event in order to process the value of seq even if we fail to parse the event.

This deserves a rework but for now it's fine.

@xacrimon xacrimon requested a review from mkrasnitski February 16, 2025 16:14
@xacrimon
Copy link
Contributor Author

@mkrasnitski ready for another look now

@mkrasnitski
Copy link
Collaborator

Can you rebase onto latest next?

@xacrimon xacrimon force-pushed the skip-intermediate-deser-btreemap-tree branch from 9440e4e to d8d1e7b Compare February 16, 2025 16:34
@xacrimon
Copy link
Contributor Author

rebased

@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 Feb 16, 2025
@arqunis arqunis merged commit 7da8e2a into serenity-rs:next Feb 16, 2025
24 checks passed
mkrasnitski pushed a commit to mkrasnitski/serenity that referenced this pull request Mar 5, 2025
…ap tree (serenity-rs#3114)

Avoid temporarily deserializing gateway messages to a `serde_json::Map<String,
Value>` before typed deserialization to an `Event`. 

Previously, this meant the creation of a `serde_json::Value` tree, causing
creation and immediately after the destruction of upwards of hundreds to
thousands of owned strings and btreemaps for every handled gateway event.
mkrasnitski pushed a commit to mkrasnitski/serenity that referenced this pull request Mar 5, 2025
…ap tree (serenity-rs#3114)

Avoid temporarily deserializing gateway messages to a `serde_json::Map<String,
Value>` before typed deserialization to an `Event`. 

Previously, this meant the creation of a `serde_json::Value` tree, causing
creation and immediately after the destruction of upwards of hundreds to
thousands of owned strings and btreemaps for every handled gateway event.
mkrasnitski pushed a commit to mkrasnitski/serenity that referenced this pull request Mar 7, 2025
…ap tree (serenity-rs#3114)

Avoid temporarily deserializing gateway messages to a `serde_json::Map<String,
Value>` before typed deserialization to an `Event`. 

Previously, this meant the creation of a `serde_json::Value` tree, causing
creation and immediately after the destruction of upwards of hundreds to
thousands of owned strings and btreemaps for every handled gateway event.
arqunis pushed a commit that referenced this pull request Mar 8, 2025
Followup to #3114.

By using an intermediate untagged enum with an `Unknown` variant, we can
process sequence numbers for unknown events without cloning the json
payload.
mkrasnitski pushed a commit to mkrasnitski/serenity that referenced this pull request Mar 10, 2025
…ap tree (serenity-rs#3114)

Avoid temporarily deserializing gateway messages to a `serde_json::Map<String,
Value>` before typed deserialization to an `Event`. 

Previously, this meant the creation of a `serde_json::Value` tree, causing
creation and immediately after the destruction of upwards of hundreds to
thousands of owned strings and btreemaps for every handled gateway event.
mkrasnitski added a commit to mkrasnitski/serenity that referenced this pull request Mar 10, 2025
Followup to serenity-rs#3114.

By using an intermediate untagged enum with an `Unknown` variant, we can
process sequence numbers for unknown events without cloning the json
payload.
mkrasnitski pushed a commit to mkrasnitski/serenity that referenced this pull request Mar 11, 2025
…ap tree (serenity-rs#3114)

Avoid temporarily deserializing gateway messages to a `serde_json::Map<String,
Value>` before typed deserialization to an `Event`. 

Previously, this meant the creation of a `serde_json::Value` tree, causing
creation and immediately after the destruction of upwards of hundreds to
thousands of owned strings and btreemaps for every handled gateway event.
mkrasnitski added a commit to mkrasnitski/serenity that referenced this pull request Mar 11, 2025
Followup to serenity-rs#3114.

By using an intermediate untagged enum with an `Unknown` variant, we can
process sequence numbers for unknown events without cloning the json
payload.
GnomedDev pushed a commit to GnomedDev/serenity that referenced this pull request Mar 26, 2025
…ap tree (serenity-rs#3114)

Avoid temporarily deserializing gateway messages to a `serde_json::Map<String,
Value>` before typed deserialization to an `Event`. 

Previously, this meant the creation of a `serde_json::Value` tree, causing
creation and immediately after the destruction of upwards of hundreds to
thousands of owned strings and btreemaps for every handled gateway event.
GnomedDev pushed a commit to GnomedDev/serenity that referenced this pull request Mar 26, 2025
Followup to serenity-rs#3114.

By using an intermediate untagged enum with an `Unknown` variant, we can
process sequence numbers for unknown events without cloning the json
payload.
GnomedDev pushed a commit to GnomedDev/serenity that referenced this pull request Mar 26, 2025
…ap tree (serenity-rs#3114)

Avoid temporarily deserializing gateway messages to a `serde_json::Map<String,
Value>` before typed deserialization to an `Event`. 

Previously, this meant the creation of a `serde_json::Value` tree, causing
creation and immediately after the destruction of upwards of hundreds to
thousands of owned strings and btreemaps for every handled gateway event.
GnomedDev pushed a commit to GnomedDev/serenity that referenced this pull request Mar 26, 2025
Followup to serenity-rs#3114.

By using an intermediate untagged enum with an `Unknown` variant, we can
process sequence numbers for unknown events without cloning the json
payload.
GnomedDev pushed a commit that referenced this pull request Apr 28, 2025
…ap tree (#3114)

Avoid temporarily deserializing gateway messages to a `serde_json::Map<String,
Value>` before typed deserialization to an `Event`. 

Previously, this meant the creation of a `serde_json::Value` tree, causing
creation and immediately after the destruction of upwards of hundreds to
thousands of owned strings and btreemaps for every handled gateway event.
GnomedDev pushed a commit that referenced this pull request Apr 28, 2025
Followup to #3114.

By using an intermediate untagged enum with an `Unknown` variant, we can
process sequence numbers for unknown events without cloning the json
payload.
GnomedDev pushed a commit that referenced this pull request May 19, 2025
…ap tree (#3114)

Avoid temporarily deserializing gateway messages to a `serde_json::Map<String,
Value>` before typed deserialization to an `Event`. 

Previously, this meant the creation of a `serde_json::Value` tree, causing
creation and immediately after the destruction of upwards of hundreds to
thousands of owned strings and btreemaps for every handled gateway event.
GnomedDev pushed a commit that referenced this pull request May 19, 2025
Followup to #3114.

By using an intermediate untagged enum with an `Unknown` variant, we can
process sequence numbers for unknown events without cloning the json
payload.
mkrasnitski pushed a commit to mkrasnitski/serenity that referenced this pull request Jun 30, 2025
…ap tree (serenity-rs#3114)

Avoid temporarily deserializing gateway messages to a `serde_json::Map<String,
Value>` before typed deserialization to an `Event`. 

Previously, this meant the creation of a `serde_json::Value` tree, causing
creation and immediately after the destruction of upwards of hundreds to
thousands of owned strings and btreemaps for every handled gateway event.
mkrasnitski added a commit to mkrasnitski/serenity that referenced this pull request Jun 30, 2025
Followup to serenity-rs#3114.

By using an intermediate untagged enum with an `Unknown` variant, we can
process sequence numbers for unknown events without cloning the json
payload.
mkrasnitski pushed a commit to mkrasnitski/serenity that referenced this pull request Jun 30, 2025
…ap tree (serenity-rs#3114)

Avoid temporarily deserializing gateway messages to a `serde_json::Map<String,
Value>` before typed deserialization to an `Event`. 

Previously, this meant the creation of a `serde_json::Value` tree, causing
creation and immediately after the destruction of upwards of hundreds to
thousands of owned strings and btreemaps for every handled gateway event.
mkrasnitski added a commit to mkrasnitski/serenity that referenced this pull request Jun 30, 2025
Followup to serenity-rs#3114.

By using an intermediate untagged enum with an `Unknown` variant, we can
process sequence numbers for unknown events without cloning the json
payload.
mkrasnitski pushed a commit to mkrasnitski/serenity that referenced this pull request Jun 30, 2025
…ap tree (serenity-rs#3114)

Avoid temporarily deserializing gateway messages to a `serde_json::Map<String,
Value>` before typed deserialization to an `Event`. 

Previously, this meant the creation of a `serde_json::Value` tree, causing
creation and immediately after the destruction of upwards of hundreds to
thousands of owned strings and btreemaps for every handled gateway event.
mkrasnitski added a commit to mkrasnitski/serenity that referenced this pull request Jun 30, 2025
Followup to serenity-rs#3114.

By using an intermediate untagged enum with an `Unknown` variant, we can
process sequence numbers for unknown events without cloning the json
payload.
mkrasnitski pushed a commit to mkrasnitski/serenity that referenced this pull request Jul 28, 2025
…ap tree (serenity-rs#3114)

Avoid temporarily deserializing gateway messages to a `serde_json::Map<String,
Value>` before typed deserialization to an `Event`. 

Previously, this meant the creation of a `serde_json::Value` tree, causing
creation and immediately after the destruction of upwards of hundreds to
thousands of owned strings and btreemaps for every handled gateway event.
mkrasnitski added a commit to mkrasnitski/serenity that referenced this pull request Jul 28, 2025
Followup to serenity-rs#3114.

By using an intermediate untagged enum with an `Unknown` variant, we can
process sequence numbers for unknown events without cloning the json
payload.
mkrasnitski pushed a commit to mkrasnitski/serenity that referenced this pull request Jul 28, 2025
…ap tree (serenity-rs#3114)

Avoid temporarily deserializing gateway messages to a `serde_json::Map<String,
Value>` before typed deserialization to an `Event`. 

Previously, this meant the creation of a `serde_json::Value` tree, causing
creation and immediately after the destruction of upwards of hundreds to
thousands of owned strings and btreemaps for every handled gateway event.
mkrasnitski added a commit to mkrasnitski/serenity that referenced this pull request Jul 28, 2025
Followup to serenity-rs#3114.

By using an intermediate untagged enum with an `Unknown` variant, we can
process sequence numbers for unknown events without cloning the json
payload.
mkrasnitski pushed a commit to mkrasnitski/serenity that referenced this pull request Oct 7, 2025
…ap tree (serenity-rs#3114)

Avoid temporarily deserializing gateway messages to a `serde_json::Map<String,
Value>` before typed deserialization to an `Event`.

Previously, this meant the creation of a `serde_json::Value` tree, causing
creation and immediately after the destruction of upwards of hundreds to
thousands of owned strings and btreemaps for every handled gateway event.
mkrasnitski added a commit to mkrasnitski/serenity that referenced this pull request Oct 7, 2025
Followup to serenity-rs#3114.

By using an intermediate untagged enum with an `Unknown` variant, we can
process sequence numbers for unknown events without cloning the json
payload.
mkrasnitski pushed a commit to mkrasnitski/serenity that referenced this pull request Oct 7, 2025
…ap tree (serenity-rs#3114)

Avoid temporarily deserializing gateway messages to a `serde_json::Map<String,
Value>` before typed deserialization to an `Event`.

Previously, this meant the creation of a `serde_json::Value` tree, causing
creation and immediately after the destruction of upwards of hundreds to
thousands of owned strings and btreemaps for every handled gateway event.
mkrasnitski added a commit to mkrasnitski/serenity that referenced this pull request Oct 7, 2025
Followup to serenity-rs#3114.

By using an intermediate untagged enum with an `Unknown` variant, we can
process sequence numbers for unknown events without cloning the json
payload.
mkrasnitski pushed a commit to mkrasnitski/serenity that referenced this pull request Oct 7, 2025
…ap tree (serenity-rs#3114)

Avoid temporarily deserializing gateway messages to a `serde_json::Map<String,
Value>` before typed deserialization to an `Event`.

Previously, this meant the creation of a `serde_json::Value` tree, causing
creation and immediately after the destruction of upwards of hundreds to
thousands of owned strings and btreemaps for every handled gateway event.
mkrasnitski added a commit to mkrasnitski/serenity that referenced this pull request Oct 7, 2025
Followup to serenity-rs#3114.

By using an intermediate untagged enum with an `Unknown` variant, we can
process sequence numbers for unknown events without cloning the json
payload.
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 enhancement An improvement to Serenity. gateway Related to the `gateway` module. model Related to the `model` module.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants