Boost logo

Boost :

Subject: Re: [boost] [pool] Calling all library designers: The future of Boost.Pool???
From: Giovanni Piero Deretta (gpderetta_at_[hidden])
Date: 2012-07-19 07:13:54


On Thu, Jul 19, 2012 at 10:28 AM, niXman <i.nixman_at_[hidden]> wrote:
>> $ g++ -O2 -DUSE_BOOST_POOL=1 -IDocuments/dev/boost_1_47_0/ test.cpp
>> $ time ./a.out
>>
>> real 0m0.422s
>> user 0m0.406s
>> sys 0m0.003s
>>
>> $ g++ -O2 test.cpp
>> $ time ./a.out
>>
>> real 0m7.065s
>> user 0m6.505s
>> sys 0m0.021s
>
> Hmm.. This is strange...
>
> On linux:
>
> $ g++ -O2 -DUSE_BOOST_POOL=1 test.cpp -opool
> $ time ./pool
> real 0m0.381s
> user 0m0.376s
> sys 0m0.000s
>
>
> $ g++ -O2 test.cpp -opool
> $ time ./pool
> real 0m0.003s
> user 0m0.000s
> sys 0m0.000s
>
>
> OS: ubuntu-12.04
> GCC: gcc-4.7.1
> boost: 1.50.0
>

It seems that the compier is pretty obviously optmizing the
malloc/free pairs away. The (dead) store is not enough to prevent the
optimization.

HTH,

-- gpd


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