On 'simple' Optimizations - Chandler Carruth - Secret Lightning Talks - Meeting C++ 2016

preview_player
Показать описание
On "simple" Optimizations - Chandler Carruth - Secret Lightning Talks - Meeting C++ 2016
Рекомендации по теме
Комментарии
Автор

Wow: thanks for the amazing shout out for Compiler Explorer :)

MattGodbolt
Автор

Update: Clang now identifies that the return value is 10!

Funnily enough, if you don’t specify v.reserve(4), you still get an allocation, but the allocation is totally unused. It calls operator new, then operator delete, then returns 10.

TheArtikae
Автор

Did you know that searching for "the number of inlining shall be three" finds Monty Python videos, not this one?

pfeilspitze
Автор

I really like Chandler Carruth's talks.

kamilziemian
Автор

Moral: run your optimizer repeatedly until the code is optimized enough ;)

SolomonUcko
Автор

Maybe you should create even more flags for the compiler. Not to throw all of them at the user's face, but to have flags that can "unlock" new options/flags, if the user is trying to go deeply in optimization.
Just an idea.

MrAbrazildo
Автор

Optimizer indeed should be able to optimize out such a trivial example with literal input in the program source etc. But what's the point? In reality, such examples probably show up only in some simple toy-benchmarks.

xealit
Автор

I like the idea of the optimiser going out to launch 😆

johnbaxter
Автор

here's how you optimize for less alllocations: don't write code that does many allocations

rubberduck
Автор

I don't see why the compiler would be expected to optimize that out. Sure, the return value is one thing but someone may actually want the heap allocation side effects

iddn
Автор

Soooo basically it is a rant because the compiler doesn't *acually* runs your code and hard-code into resulting executable? .. interesting

dengan
Автор

Why should this be optimized? It shouldn't.

rubberduck