Boost logo

Boost :

Subject: Re: [boost] [Block Pointer] make_block
From: Phil Bouchard (philippe_at_[hidden])
Date: 2011-04-30 14:09:19


On 4/30/2011 9:59 AM, Phil Bouchard wrote:
> On 4/30/2011 8:05 AM, Mathias Gaunard wrote:
>> On 30/04/2011 02:38, Phil Bouchard wrote:
>>>
>>> time of new block:
>>> 0.144u 0.016s 0:00.16 93.7%
>>>
>>> time of make_block:
>>> 0.328u 0.012s 0:00.34 97.0%
>>>
>>> Any thoughts?
>>
>> There is no difference between
>>
>> block_ptr<T> a = make_block<T>(whatever);
>> and
>> block_ptr<T> a(new block<T>(whatever));
>>
>> Your temporaries in question are removed by NRVO.
>
> That's right, with the optimization flags turned on I get:
> 0.116u 0.004s 0:00.12 91.6%
>
> (This is block_ptr_test3 BTW)

Sorry operator new is still faster with optimization flags turned on:
time of new block (O3):
0.044u 0.040s 0:00.09 88.8%

time of make_block (O3):
0.116u 0.004s 0:00.12 91.6%

-Phil


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