
----- Original Message ----
From: Dave Abrahams <dave@boostpro.com> To: boost@lists.boost.org Sent: Sat, March 5, 2011 12:21:50 AM Subject: Re: [boost] [xint] Performance of fixed-size large integers
At Fri, 4 Mar 2011 13:58:36 -0800 (PST), Artyom wrote:
I personally think that COW approach would be very useful for most of users while move is "nice-to-have".
That's interesting, but it doesn't help me form my own opinion. Maybe if you told us on what basis you came to that conclusion, it would be more helpful. Have you done any tests to see how easily/quickly a type implemented with move emulation works as compared to one implemented with COW? Have you got concrete examples?
I'm not talking about performance I'm talking about what users would do. How many developers would write: { ... foo.set_value(boost::move(some_big_int)); // some big int goes out of scope } Over { ... foo.set_value(some_big_int); // some big int goes out of scope } In case you really need a copy of the value and not reference/const reference. We should remember that not all Boost audience is familiar with "movable" concept. Even good C++ programmers do not really live on the edge and use the-state-of-the-art tools. And this is the vast majority of good C++ programmers. Now if we take a look on thous who are actually going to use Xint - algorithms developers, mathematicians and cryptographers who actually use and know C++ but do not live at the edge. So I can say that COW would give an immediate benefit while MOVE would give some benefit to some users. I'm telling let's look on the wider picture and not the narrow one. Finally we write our libraries to be useful for much less competent programmers. And unfortunately this is the reality. I think it is likely smart users would rather use the old school move set_value(int_type &integer) { integer_.swap(integer); } Then boost::move. And BTW it would be more clear for vast majority of code maintainers that are even less competent then the mathematicians who had written the code at the begging. It is sad but this is the reality, because I see at daily basis what kind of code the real programmers write, and Boost.Move is far beyond their capabilities. That is why COW would be much better for real programmers at least in near 5 years till boost::move or std::move would become mainstream. Artyom