4 ms·
> std::exception does not take a string in its constructor You're right, I used it as a short-hand for our internal exception function, forgetting that the std
by koyote 2y ago
> std::exception does not take a string in its constructor
You're right, I used it as a short-hand for our internal exception function, forgetting that the std one does not take a string.
Our error handling function is a simple static function that takes an std::string and throws a newly constructed object with that string as a field.
But yes, it could very well have been that the string surpassed the short string optimisation threshold or something similar.
I did verify the assembly before and after and the function definitely inlined before and no longer inlined after. Moving the 'throw' (and, importantly, the string literal) into a separate function that was called from the same spot ensured it inlined again and the performance was back to normal.