[PATCH] D35145: Use emplace_back to replace size() and resize().

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 9 07:16:01 PDT 2017


tejohnson accepted this revision.
tejohnson added a comment.
This revision is now accepted and ready to land.

LGTM

In https://reviews.llvm.org/D35145#802899, @grandinj wrote:

> I'm curious if you know why emplace_back is so much faster than resize(size+1) ?


My understanding is that resize copies in the default value whereas emplace_back constructs one in place, and the latter is more efficient (especially when only 1 element being added to the list). Dehao - is that the reasoning you had?


https://reviews.llvm.org/D35145





More information about the llvm-commits mailing list