News for hackers. Stuff that matters.
Re:gRPC benchmark results by habibur on Saturday May 08, 2021 @07:28AM (#27086123)
Ref counting is more efficient than any GC allocator, which is generally the default in C++.
Re:gRPC benchmark results by qalmakka on Saturday May 08, 2021 @08:14AM (#27086437)
I don't know, is it though? Properly done reference counting AFAIK requires using atomic increase/decrease in order to be safe, and that creates a bit of overhead every time you assign a reference, while assignment to a reference with a precise GC is basically a pointer assignment. It's much better for latency though, given that the overhead from rc is deterministic. It has been a few years though since I've looked into garbage collection techniques, so I could be a bit rusty about the current state of the art.
Re:gRPC benchmark results by paavohtl on Saturday May 08, 2021 @11:53AM (#27088247)
You only need atomic reference counting if you're sharing objects between multiple threads, but if you use an object from one thread at a time then non-atomic inc/dec is enough. Rust allows you to make the choice between the two kinds and the compiler can infer which kind you need to use.
Re:gRPC benchmark results by qalmakka on Saturday May 08, 2021 @05:00PM (#27090628)
Yeah - Rust can, because it also ensures you can't exchange data unsafely between threads, but C++ can't. That's why `std::shared_ptr` has to be thread-safe.
Re:gRPC benchmark results by gher-shyu3i on Sunday May 09, 2021 @08:02PM (#27101097)
Not necessarily. Bump allocations are extremely cheap, and collections can be batched to avoid interruption and performance impact.