[libcxx-commits] [libcxx] [libc++] Mark __{emplace, push}_back_slow_path as noinline (PR #94379)

via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jun 4 17:57:09 PDT 2024


gerben-stavenga wrote:


When someone optimizes some code one can equivalent ask "Code is 20% too slow, but how does that matter concretely to you?" Well, I can confidently say I'm not suffering terribly personally.

I'm not seeing it as you pasted it, but "return std::move(v);" does indeed do the trick. Never do RVO for vector, always std::move a vector.

https://godbolt.org/z/j4q5EcqK9

Anyway, I'm just pointing out what, to me at least, is obviously too much code generated for what push_back does. We do suffer from massive binaries and often it's a death by thousands cuts and a lot of code that just is too bloated. The c++ standard due to it's templated nature often contributes significantly.  Now I think due to it's fundamental status in the ecosystem it's good to give code generation of standard lib functions a good inspection.

https://github.com/llvm/llvm-project/pull/94379


More information about the libcxx-commits mailing list