Hi,
On http://www.ddj.com/database/184403855, it says
"...the goal is portable efficiency — 100% elimination of unnecessary
copies, without dependence on one particular RVO implementation."
But if there is RVO in the compiler that I'm using (I think GCC has
it, right?) and I do not care about other compiler, do I still need
the technique mentioned on that webpage?
Thanks,
Peng 5 2243
Peng Yu wrote:
Hi,
On http://www.ddj.com/database/184403855, it says
"...the goal is portable efficiency — 100% elimination of unnecessary
copies, without dependence on one particular RVO implementation."
But if there is RVO in the compiler that I'm using (I think GCC has
it, right?) and I do not care about other compiler, do I still need
the technique mentioned on that webpage?
That depends on whether your compiler can actually apply
RVO in your specific case and how much you depend on that
being the case.
Thanks,
Peng
Schobi
On Oct 21, 5:16 pm, Hendrik Schober <spamt...@gmx.dewrote:
Peng Yu wrote:
Hi,
Onhttp://www.ddj.com/database/184403855, it says
"...the goal is portable efficiency — 100% elimination of unnecessary
copies, without dependence on one particular RVO implementation."
But if there is RVO in the compiler that I'm using (I think GCC has
it, right?) and I do not care about other compiler, do I still need
the technique mentioned on that webpage?
That depends on whether your compiler can actually apply
RVO in your specific case and how much you depend on that
being the case.
Do you have a summary on how many cases could be for RVO? If I know
all the cases, then I can make a sound decision on what I should for
each case?
Do you know how different many commonly used compilers are in the
aspect of RVO?
Thanks,
Peng
On 21 Okt, 22:30, Peng Yu <PengYu...@gmail.comwrote:
Hi,
Onhttp://www.ddj.com/database/184403855, it says
"...the goal is portable efficiency — 100% elimination of unnecessary
copies, without dependence on one particular RVO implementation."
But if there is RVO in the compiler that I'm using (I think GCC has
it, right?) and I do not care about other compiler, do I still need
the technique mentioned on that webpage?
If you are using gcc 4.3, and do not care about portability, you can
use rvalue references to implement move construction and move
assignment. It's the same principle, but with direct language
support.
Thanks,
Peng
In article <c5**********************************@l77g2000hse. googlegroups.com>,
Peng Yu <Pe*******@gmail.comwrote:
>On Oct 21, 5:16 pm, Hendrik Schober <spamt...@gmx.dewrote:
>Peng Yu wrote:
Hi,
Onhttp://www.ddj.com/database/184403855, it says
"...the goal is portable efficiency — 100% elimination of unnecessary
copies, without dependence on one particular RVO implementation."
But if there is RVO in the compiler that I'm using (I think GCC has
it, right?) and I do not care about other compiler, do I still need
the technique mentioned on that webpage?
That depends on whether your compiler can actually apply RVO in your specific case and how much you depend on that being the case.
Do you have a summary on how many cases could be for RVO? If I know all the cases, then I can make a sound decision on what I should for each case?
In which situation RVO does apply or not is not what is important.
What is important is what part of your code is causing an *actual*
performance bottleneck.
I generally like Alexandrescu's writings but this one IMO is a case of
code obfuscation in search of performance. This is all fine if
performance is needed but IMO in the general case, development speed,
maintainability and quality are far more important. If it is
necessary because you are in the presence of a measured performance
bottleneck, then by all mean, go for it. In the general case, I don't
think so.
Yannick
Peng Yu wrote:
On Oct 21, 5:16 pm, Hendrik Schober <spamt...@gmx.dewrote:
>Peng Yu wrote:
>>Hi, Onhttp://www.ddj.com/database/184403855, it says "...the goal is portable efficiency — 100% elimination of unnecessary copies, without dependence on one particular RVO implementation." But if there is RVO in the compiler that I'm using (I think GCC has it, right?) and I do not care about other compiler, do I still need the technique mentioned on that webpage?
That depends on whether your compiler can actually apply RVO in your specific case and how much you depend on that being the case.
Do you have a summary on how many cases could be for RVO? If I know
all the cases, then I can make a sound decision on what I should for
each case?
Do you know how different many commonly used compilers are in the
aspect of RVO?
No. This is all compiler-dependent. You have to know the innards
of your compiler to know ahead for sure. If you lack that, you'll
just have to try.
Peng
Schobi This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Ryan Mitchley |
last post by:
Hi
I have a rather complicated class for performing matrix operations using
complex arithmetic.
I have written two classes, CComplexMatrix and CComplexMatrixTemp, and have
been attempting to...
|
by: Jakob Bieling |
last post by:
Hi!
I am using VC++ 7.1 and have a question about return value optimization.
Consider the following code:
#include <list>
#include <string>
struct test
{
|
by: Gama Franco |
last post by:
Hi,
I'm designing an interface for a shared library, and I would like to
know if there is a standard about how to return an object to the user. I
will use exceptions to report errors, so there...
|
by: bipod.rafique |
last post by:
Hello all,
Even though this topic has been discussed many times, I still need your
help in clearing my confusions. Consider the following code:
class aclass{
public:
aclass(){
|
by: Eric Lilja |
last post by:
Hello, consider this complete program:
#include <iostream>
#include <string>
using std::cout;
using std::endl;
using std::string;
class Hanna
{
|
by: Axel Bock |
last post by:
Hi all,
I am trying to get my head around what happens if I return a class
object from a function.
It seems C++ (MinGW) does not invoke the copy constructor if I do
something like this:
...
|
by: Kirit Sælensminde |
last post by:
Thanks to a link I followed from here or clc++m (thanks to whoever
posted, but I don't remember which post or even which thread it was
now) I got to Andrei Alexandrescu's Doctor Dobbs article on...
|
by: SzH |
last post by:
The code below demonstrates that the copy constructor of moo is not
called on the first line of main. In spite of this, g++ (version 4.1.2)
refuses to compile it if I make the copy constructor...
|
by: terminator(jam) |
last post by:
consider:
struct memory_pig{//a really large type:
memory_pig(){
std::cout<<"mem pig default\n";
//etc...
};
memory_pig(memory_pig const&){
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |