Skip to content

Serialize values using MessagePack instead of bincode#3466

Open
badboy wants to merge 1 commit into
sqlite/use-modulefrom
sqlite/switch-to-msgpack
Open

Serialize values using MessagePack instead of bincode#3466
badboy wants to merge 1 commit into
sqlite/use-modulefrom
sqlite/switch-to-msgpack

Conversation

@badboy
Copy link
Copy Markdown
Member

@badboy badboy commented May 27, 2026

The bincode crate isn't maintained anymore.
While it's been stable and without issues for us for years, switching to anotherformat is easy while we're switching the database anyway. MessagePack can be even smaller than bincode for the same data (just a couple of bytes here and there).

Whether it's actually faster has not been benchmarked. Compared to everything else the (de)serialization overhead is probably a small fraction of the whole thing.

Why do we need serialization anyway?
Ping assembly does not have any knowledge of metrics. It only knows what's in the database.
So in order to put in in the right place in the ping payload we need to know the type of the stored data. That data needs to be somewhere.
By serializing the whole value (the Metric enum) we can deserialize it into that enum and the serde part takes care of "knowing" the type.

@badboy badboy requested a review from a team as a code owner May 27, 2026 14:47
@badboy badboy requested review from travis79 and removed request for a team May 27, 2026 14:47
@badboy badboy added the sqlite Any changes to the new SQLite storage backend label May 27, 2026
The bincode crate isn't maintained anymore.
While it's been stable and without issues for us for years,
switching to anotherformat is easy while we're switching the database anyway.
MessagePack can be even smaller than bincode for the same data (just a couple of bytes here and there).

Whether it's actually faster has not been benchmarked. Compared to
everything else the (de)serialization overhead is probably a small
fraction of the whole thing.

Why do we need serialization anyway?
Ping assembly does not have any knowledge of metrics.
It only knows what's in the database.
So in order to put in in the right place in the ping payload we need to know the type of the stored data.
That data needs to be somewhere.
By serializing the whole value (the `Metric` enum) we can deserialize it
into that enum and the serde part takes care of "knowing" the type.
@badboy badboy force-pushed the sqlite/use-module branch from 02c85a8 to dc65b5b Compare May 27, 2026 15:01
@badboy badboy force-pushed the sqlite/switch-to-msgpack branch from 51654dc to 3b686b3 Compare May 27, 2026 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sqlite Any changes to the new SQLite storage backend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant