4 ms·
That is the entire point of the post. If you leave the resolution of malloc to run time, the best you can hope for is that new calls malloc, out of line. If you
by jeffbee 7y ago
That is the entire point of the post. If you leave the resolution of malloc to run time, the best you can hope for is that new calls malloc, out of line. If you build with an implementation of new, the outcomes may be dramatically better.
By the way there is no such thing as std::new. We are discussing ::new.
- mitchs 7y agoHeh, std::new was some cruft I got out of backtrace(3) with some wacky embedded tool chain. Are these gains supposed to be from inlining the top level function of malloc into new? Compared to the costs of what can go on inside malloc... Is that the biggest problem?
- ckennelly 7y agoDynamic linking requires calling through the PLT to get to the implementation, so there's a data dependency on determining where the code for it is. Independent of inlining (with LTO, since the C++ language rules requires inhibit optimizing out "operator new"), the static call is far simpler.