CppCon 2018: Arthur O'Dwyer “Return Value Optimization: Harder Than It Looks”

  Рет қаралды 20,792

CppCon

CppCon

Күн бұрын

Пікірлер: 23
@ashrasmun1
@ashrasmun1 6 жыл бұрын
Ultra concise and incredibly useful. Happy to stumble upon that :)
@mockingbird3809
@mockingbird3809 3 жыл бұрын
Very useful talk learned a lot about x86 asm too. Thanks for those quick overview of the x86 basics on call/return :)
@CppCon
@CppCon 3 жыл бұрын
Glad it was helpful!
@xealit
@xealit 3 ай бұрын
16:00 the return IPF64(IPF32&&); - why does it work in this case? The type of the first parameter is not IPF64 here either. - Ah! wait, the constructors are templated, and there is a IPF64(IPF32&&). Did not notice that. And I thought you'd have to make it use the move before: IPF64 result = get_upstream_callback(); return result; And it is the same to use IPF32::operator IPF64 probably.
@dirtbikersteve
@dirtbikersteve 6 жыл бұрын
3:00 rdi movs to rax so that once return slot is filled that by convention the return register (rax/eax) holds this pointer to return slot.
@MatthijsvanDuin
@MatthijsvanDuin 6 жыл бұрын
That part is completely obvious, at the very least to the speaker (given his experience working on compilers). The big question is why this convention exists. It has no obvious utility and no such convention exists e.g. on ARM or PowerPC.
@dennydaydreamer
@dennydaydreamer 2 жыл бұрын
For the Cexpr example, if there exists a constructor Cexpr(CexprList&&) that does the slicing by moving, would it have been called?
@shahmiBro1
@shahmiBro1 6 жыл бұрын
Durian is not a problem, it just a matter of an individual's taste;
@notnullnotvoid
@notnullnotvoid 6 жыл бұрын
This kind of insanity is why plain old C is still alive and well.
@VioletGiraffe
@VioletGiraffe 5 жыл бұрын
And also why it sucks.
@bobweiram6321
@bobweiram6321 Жыл бұрын
Ada is the way.
@dingliu5273
@dingliu5273 3 жыл бұрын
Brilliant talk, I love it!
@zhivkobogdanov2845
@zhivkobogdanov2845 3 жыл бұрын
It's worth mentioning that copy elision will not be performed, as far as I am aware, if you have multiple return points or some initialization that follows a certain condition. Try to avoid those. :-)
@axelBr1
@axelBr1 Жыл бұрын
I believe the following will work (i.e. not create a copy), but uses a Move. If a is made const it might work, (i.e. not make a copy) A foo() { if ( condition ) { A a = …; … return a; } else { A a = …; … return a; } };
@isitanos
@isitanos 4 жыл бұрын
Not convinced by the example at p.32. It might be impossible to optimize based on a limited view of only the current function, but if the parameter passed is a temporary, it should be possible to keep collapsing until you have only one memory location left.
@Xeverous
@Xeverous 6 жыл бұрын
In many cases, compilers were better than the standard - but isn't this actually allowed? Can the perform RVO better than the standard says because of the as-if rule?
@MatthijsvanDuin
@MatthijsvanDuin 6 жыл бұрын
All the headache here is related to classes with user-defined copy and/or move constructors, in which case copy elision (including RVO) and implicit move are semantic changes that do not fall under the as-if rule and therefore require explicit permission from the standard.
@JohnDlugosz
@JohnDlugosz 5 жыл бұрын
The description is wrong. "he'll walk through the relatively painless process of creating that diagnostic, and perhaps inspire you to contribute to Clang yourself!" is not included here. This is a shortened version of the presentation.
@yuehuajia3176
@yuehuajia3176 6 жыл бұрын
good talk.
@User-cv4ee
@User-cv4ee Жыл бұрын
Man this is waaaayy too complicated. I can wrap my head (maybe?) around some of these snippets but on a production code..not really sure. Great presentation btw. You tried your best but the topic is just too complicated.
@GeorgeTsiros
@GeorgeTsiros 6 жыл бұрын
uuhm aaah aaahm I would have walked out in the first minute. Learn to speak.
@vivekveer3272
@vivekveer3272 Жыл бұрын
who hurt you dude? a bit of stuttering is fine, much better than a robotic presentation. The content was good too.
@yuehuajia3176
@yuehuajia3176 6 жыл бұрын
good talk.
CppCon 2018: Jason Turner “Surprises in Object Lifetime”
1:01:28
The evil clown plays a prank on the angel
00:39
超人夫妇
Рет қаралды 53 МЛН
Мен атып көрмегенмін ! | Qalam | 5 серия
25:41
How to treat Acne💉
00:31
ISSEI / いっせい
Рет қаралды 108 МЛН
1% vs 100% #beatbox #tiktok
01:10
BeatboxJCOP
Рет қаралды 67 МЛН
Return Value Optimization and Copy Elision in C++
9:54
mCoding
Рет қаралды 40 М.
C++ vs Rust: which is faster?
21:15
fasterthanlime
Рет қаралды 412 М.
Back to Basics: Concurrency - Arthur O'Dwyer - CppCon 2020
1:04:28
The evil clown plays a prank on the angel
00:39
超人夫妇
Рет қаралды 53 МЛН