4 ms·
> Poor performance. Usually, it is significantly more efficient to allocate and free resources in batches. This one is big. It is a lot of accounting work to i
by conradev 2y ago
> Poor performance. Usually, it is significantly more efficient to allocate and free resources in batches.
This one is big. It is a lot of accounting work to individually allocate and deallocate a lot of objects.
The Zig approach is to force you to decide on and write all of your allocation and deallocation code, which I found leads to more performant code almost by default – Rust is explicitly leaving that on the table. C obviously works the same way, but doesn't have an arena allocator in the standard library.
Re: C++ vs Rust, it might be more of a pain in Rust because of this: https://news.ycombinator.com/item?id=33637092 https://news.ycombinator.com/item?id=33637092
- ladyanita22 2y agoI am happy that Rust defaults to the easier, saner, safer approach by default, but lets you bypass RAII if you want to do so.
- conradev 2y agoYeah, I agree. It makes sense and I'm glad that Drop is in no way guaranteed. I am excited for allocator-api to eventually stabilize, too!