[llvm] r290685 - [NewGVN] replace emplace_back with push_back

Piotr Padlewski via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 28 14:34:14 PST 2016


2016-12-28 22:09 GMT+01:00 Daniel Berlin <dberlin at dberlin.org>:

>
>
> On Wed, Dec 28, 2016 at 12:36 PM, Piotr Padlewski via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
>
>> Author: prazek
>> Date: Wed Dec 28 14:36:08 2016
>> New Revision: 290685
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=290685&view=rev
>> Log:
>> [NewGVN] replace emplace_back with push_back
>>
>
> I'm somewhat against this change.
> It would be nice to have coding guidelines here.
>
>
True, I gonna start thread about it soon.

>
>> emplace_back is not faster if it is equivalent to push_back. In this
>> cases emplaced value had the
>> same type that the one stored in container. It is ugly and it might be
>> even slower (see
>> Scott Meyers presentation about emplacement).
>>
>
> I'm going to disagree about "ugly", i don't think it's ugly or not ugly.
> If it's really slower, i'd like to see numbers.
> Otherwise, i think we should just be consistent if we can.
>
>
Some numbers:
https://youtu.be/smqT9Io_bKo?t=29m16s

It is for map insert/emplace. It probably doesn't matter much for
emplace_back, it only can add extra instantiations,
but I guess we don't want to have diffrent rules for using insert/emplace
and push_back/emplace_back

There is also some useful info here:
http://clang.llvm.org/extra/clang-tidy/checks/modernize-use-emplace.html

Piotr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161228/25a4ac18/attachment.html>


More information about the llvm-commits mailing list