3Hren / 3Hren/msgpack-rust

Avoid allocation for each serialization [Feature]

Open
#289 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
1.4k
Forks
162
PR merge metrics
No merged PRs in 30d

Description

I love using `rmp_serde`, great work.

I'm interested in very high-performance client-server interactions.

One thing that bothers me about `rmp_serde` is that allocation is forced for each serialization (`to_vec` internally creates its own vector). This lowers performance, if I serialize millions of messages, I could have a pool of buffers amortizing allocation costs and increasing data-cache hits inside the CPU (for the later step when these buffers are read).

Would it be feasible to add a function like `to_existing_vec(val: &T, buffer: &mut [u8])`?

I am not familiar with the ownership mechanics inside the serializer, so I understand if this is turns out to actually be really hard or impossible.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.