Testing which binary encoder compiles faster

⚓ Rust    📅 2026-05-18    👤 surdeus    👁️ 1      

surdeus

I had an issue with crate performance in IDE. My Rust crate, ~12000 SLOC, was very slow in VS Code. I figured out some measures against slowdown: split the crate, use less generic-heavy structs.

But I also found out that Serde derive macros were seriously slowing things down. So I wrote my own traits, that were calling Zerocopy's methods to save data.

Now I wanted to test honestly, how slower Serde will be given the same structs.

I made this crate that generates random structures and some stub code to prevent code optimizations. There's a chart with the results on different sizes, and also an example of generated code.

I found that bincode has derive macros now too, and added them. There was packbytes crate, but couldn't write test code for it.

Here's the result table. Please post your comments.

изображение

1 post - 1 participant

Read full topic

🏷️ Rust_feed