dropbox / pb-jelly

A protobuf code generation framework for the Rust language developed at Dropbox.
Apache License 2.0
611 stars 25 forks source link

Improve performance of deserialization for `String` #23

Closed ParkMyCar closed 4 years ago

ParkMyCar commented 4 years ago

Similar to #22, we use bytes::put(...) instead of std::io::read* methods to de-serialize a String. Similar to a Vec<u8> these changes result in about a 10x performance increase.

I added a benchmark that tests de-serializing a message that contains a String that is the entirety of Moby Dick: Before: 1,000,000 ns After: 100,000 ns