Zero Cost Abstractions
As I understand it, examples of &quot;zero cost abstractions&quot; would be std::string or std::map&lt;X,Y&gt; in C++. Reimplementing those in plain C is not a great idea, because the result will be very bug-prone, and will not be (significantly) faster.<p>The problem with these &quot;zero cost abstractions&quot; is that we&#x27;re measuring the wrong cost.<p>The key to efficiency is optimizing <i>what</i> is done, not optimizing each little line of code. std::string is a terrible idea with regards to efficiency. If it works for you chances are you should use Python instead. For anything complex, std::string is slow and has a huge memory footprint (each string has its own buffer, separately allocated from the heap). It also leads to a heavy increase in compilation times. Anecdotally, it can even be painful to depend on it when the standard library is upgraded. If you have anything beyond a few megabytes worth of text data, std::string is about the worst possible technical solution.