Re:Why is Rust slightly slower than C?
by fulafel on Thursday September 12, 2019 @09:55AM
(#20951453)
We all know the acronym stands for "Resource Allocation Is Initialization" - and that in the real world the two often have no reason to be semantically coupled. IOW lots of optimization patterns involve decoupling initialization from allocation and the RAII meme encourages programmers to codify the coupling because C++'s shortcomings make it attractive.
[ Parent
| on HN ]
Re:Why is Rust slightly slower than C?
by verall on Thursday September 12, 2019 @02:34PM
(#20954762)
That is what RAII stands for, but in practice good use of C++ RAII is all about explicitly separating interface, allocation, and ownership, such that you only pay for as much initialization as you need when you need it.
This takes great care which takes time and leads to slow development. I think of C++ as worth it when this level of care is necessary to create a well-performing system.
I would agree that most toy examples don't do a good job of explaining how to use RAII in a careful high performing way