News for hackers. Stuff that matters.
Re:Fivefold Slower Compared to Go? Optimizing Rust's Protobu... by sapiogram on Friday April 12, 2024 @06:47AM (#40011175)
I haven't dug into the code, but it's clear that the Golang library has had a ton of optimization work put into it by very knowledgeable people. Techniques like object pooling are highly error prone, and certainly not "out of the box" Golang.

The Rust code and the blog post, on the other hand, seem to be written by someone less familiar with Rust and high-performance parsing. I think they would have avoided all their problems if they just used lifetimes to safely avoid copying from the start, instead of relying on increasingly elaborate workarounds like the `Bytes` crate. Apart from one "forces one to deal with the contagion of lifetimes" comment in the conclusion, they never mention why they didn't do this, even though it's clearly the idiomatic Rust solution. Maybe they had technical reasons for not doing lifetimes, but to me it just seems like unfamiliarity with Rust.

Re:Fivefold Slower Compared to Go? Optimizing Rust's Protobu... by formerly_proven on Friday April 12, 2024 @07:22AM (#40011333)
I’m unfamiliar with all of the libraries used here, however, the solutions from the blog post struck me as quite odd. serde::Deserializer solves a similar problem and makes it quite straightforward and safe to borrow from the input, if possible. Obviously, the input needs to outlive the borrowed values.
Re:Fivefold Slower Compared to Go? Optimizing Rust's Protobu... by littlestymaar on Friday April 12, 2024 @07:41AM (#40011441)
> Apart from one "forces one to deal with the contagion of lifetimes" comment in the conclusion

I guess that must be the logical consequence of the “async function are contagious” meme… I wonder if at some point we end up with people arguing that dynamic typing is obviously better because it avoids “contagion with types”.

Re:Fivefold Slower Compared to Go? Optimizing Rust's Protobu... by lossolo on Friday April 12, 2024 @05:49PM (#40018046)
> Techniques like object pooling are highly error prone, and certainly not "out of the box" Golang.

This one is actually out of the box in Golang, it's called sync.Pool and is accessible in the standard library. It's very easy to use and not error prone, I've used it many times without any issues.

But creator of VictoriaMetrics is indeed someone very knowledgeable and known in Golang community in context of optimization.