Boost logo

Boost :

Subject: Re: [boost] [proposal] raw move (was: [interest] underlying type library)
From: Gottlob Frege (gottlobfrege_at_[hidden])
Date: 2011-08-23 23:12:13


On Tue, Aug 23, 2011 at 9:44 AM, Julian Gonggrijp <j.gonggrijp_at_[hidden]> wrote:
> Christopher Jefferson wrote:
>
>> Can you first of all give a good example (with source) of where using move_raw would out-perform move assignment / constructors from C++0x, particularly in any standard library function (random_shuffle has a fairly small implementation for example). I don't really see how it will help that much.
>
> There is a very simple reason why move_raw will outperform move
> assignment for any non-POD type:
>
> move assignment = move_raw + fixing up the source object ,
>

raw_move assumes that later the algorithm will raw_move back into the
temporarily invalid source object. So sooner or later we write to
that memory. Depending on caching scenarios, it might actually be
faster to write to that memory *sooner*. It is very hard to tell - it
depends on the amount of data, the locality of the data, the type of
CPU/memory/bus/architecture, etc etc etc.
But I wouldn't be that surprised if raw_move offered no speed up in most cases.

Tony


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk