3 ms·
> The way I read it was "malloc is a hot function, therefore you should try to avoid using it". We agree that's a non-sequiter in the more general case at leas
by MaulingMonkey 10y ago
> The way I read it was "malloc is a hot function, therefore you should try to avoid using it".
We agree that's a non-sequiter in the more general case at least ("X is a hot function ...") - but even in the more general case, it's not an error to state that it may be worth avoiding, which would be a more accurate reading IMO. It's an avenue to investigate.
> When talking about a function with many thousands of individual call sites, eliminating them one at a time isn't practical.
I've done it before (refactoring logging macros, static_assert s due to macros conflicting with builtins on new compilers, even fixing up allocation interfaces to better trace call sites, etc.)
It's painful and laborious, but sometimes worthwhile.