
19 Jul
2012
19 Jul
'12
11:13 a.m.
On Thu, Jul 19, 2012 at 10:28 AM, niXman <i.nixman@gmail.com> 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