3 ms·
> For C++ programs, replacing malloc and free at runtime is the worst choice. When the compiler can see the definition of new and delete at build time it can ge
by AshamedCaptain 7y ago
> For C++ programs, replacing malloc and free at runtime is the worst choice. When the compiler can see the definition of new and delete at build time it can generate far better programs. When it can’t see them, it generates out-of-line function calls to malloc for every operator new, which is bananas.
This argument smells like bullshit, sorry, and it's totally not justified in the article. Giving just numbers without even explaining a potential causality points to benchmark setup failure more than anything.
Unless you are talking about statically linking your malloc implementation, your entire STL and all depending libraries AND then performing LTO on it, and even then I'd be surprised if there's any noticeable improvement over this.
Not to mention I don't know of _any_ real-life executable that does this...
- notacoward 7y ago> statically linking your malloc implementation AND then performing LTO This is exactly how some large tech companies build all their executables. You might not get to run those, but they definitely exist.
- jlebar 7y agoThere indeed isn't a ton of detail in TFA, and so I can understand your skepticism. Jeff Baker is an expert on this at Google. Until you've seen the sorts of analyses that are conducted inside of Google, it may be hard to appreciate the level of scrutiny that every CPU instruction in tcmalloc has gotten from people like Jeff.
- banachtarski 7y ago> This argument smells like bullshit, sorry, and it's totally not justified in the article. Giving just numbers without even explaining a potential causality points to benchmark setup failure more than anything. Why? This argument sounds perfectly reasonable and is true in many other contexts as well.
- deleted 7y ago[deleted]
- username90 7y ago> Not to mention I don't know of _any_ real-life executable that does this... Basically everything at Google is built this way.