Re:Fivefold Slower Compared to Go? Optimizing Rust's Protobu...
by v0y4g3r on Friday April 12, 2024 @09:10AM
(#40012259)
WriteRequest::timeseries is a vector (https://github.com/prometheus/prometheus/blob/main/prompb/re...) and
the repeated file `Timeseries::labels` and `Timeseries::samples` are reused across different timeseries. You don't have to alloc a new vector for the lables and samples for each new timeseries instance.
[ Parent
| on HN ]
Re:Fivefold Slower Compared to Go? Optimizing Rust's Protobu...
by K0nserv on Friday April 12, 2024 @10:21AM
(#40013234)
That would be true if you used `Vec::clear` too, it doesn't allocate a new vector. My point was that you still end up running Drop implementations with RepeatedField<T>, just not all at once. See https://play.rust-lang.org/?version=stable&mode=debug&editio...