8 ms·
It's hard to know how to take this given that their first example (function call overhead) seems deeply flawed -- you'd never have a 'compare' strings function
by fractaled 2y ago
It's hard to know how to take this given that their first example (function call overhead) seems deeply flawed -- you'd never have a 'compare' strings function take std::string by value. (Maybe const string& or string_view). Also, the alternative would have to have a destructor of some type (unless it is a string_view analog) to make it an apples to apples comparison.
- mistrial9 2y agothe entire article rests on a shorter String that can be fit on registers reliably. If you have bytes in registers, it is not clear that passing bytes by value is "deeply flawed."
- fractaled 2y agoYou'd never have a `compare(std::string a, std::string b)` function in your code base. It would make copies of the strings (and destroy them). So it seems to me the article is comparing their new thing to a straw man.