Boost logo

Boost Users :

From: Lothar Werzinger (lothar_at_[hidden])
Date: 2008-07-16 15:35:02


Hi,

If I compile the attached test with and without compile optimizations with G++
4.3.1 the non optimized version (using optimize_size<false>) is more than 10
times faster than the optimized one.
I did use oprofile on the application where I use the avl set and the time is
spent in the 'find' call.

Can you please try to shed some light on this, I am completely stumped.
Any help is appreciated!

here is how I built the attached test:

$ /opt2/linux/ix86/bin/g++-4.3.1 -m64 -O3 -g -I/opt2/linux/x86_64/include/boost-1_35 -DUSE_OPTIMIZATION=0 -o ./avltest-no ./avltest.cpp
./avltest.cpp:21:2: warning: #warning without optimization

$ /opt2/linux/ix86/bin/g++-4.3.1 -m64 -O0 -g -I/opt2/linux/x86_64/include/boost-1_35 -DUSE_OPTIMIZATION=0 -o ./avltest-nn ./avltest.cpp
./avltest.cpp:21:2: warning: #warning without optimization

$ /opt2/linux/ix86/bin/g++-4.3.1 -m64 -O3 -g -I/opt2/linux/x86_64/include/boost-1_35 -DUSE_OPTIMIZATION=1 -o ./avltest-oo ./avltest.cpp
./avltest.cpp:21:2: warning: #warning with optimization

$ /opt2/linux/ix86/bin/g++-4.3.1 -m64 -O0 -g -I/opt2/linux/x86_64/include/boost-1_35 -DUSE_OPTIMIZATION=1 -o ./avltest-on ./avltest.cpp
./avltest.cpp:21:2: warning: #warning with optimization

$ time ./avltest-nn
sizeof(BalanceNode)=32
sizeof(BalanceSet)=40
creating file /tmp/avltest.img done
region.get_address()=0x7fd715fc2000
region.get_size()=1600056
p_set=0x7fd715fc2000
p_values=0x7fd715fc2030
created/inserted 50000 entries
region.get_address()=0x7fd715fc2000
region.get_size()=1600056
p_set=0x7fd715fc2000
p_values=0x7fd715fc2030
checked 50000 entries

real 0m1.031s
user 0m0.956s
sys 0m0.008s

$ time ./avltest-no
sizeof(BalanceNode)=32
sizeof(BalanceSet)=40
creating file /tmp/avltest.img done
region.get_address()=0x7f70b6db6000
region.get_size()=1600056
p_set=0x7f70b6db6000
p_values=0x7f70b6db6030
created/inserted 50000 entries
region.get_address()=0x7f70b6db6000
region.get_size()=1600056
p_set=0x7f70b6db6000
p_values=0x7f70b6db6030
checked 50000 entries

real 0m20.803s
user 0m20.233s
sys 0m0.028s

$ time ./avltest-on
sizeof(BalanceNode)=32
sizeof(BalanceSet)=32
creating file /tmp/avltest.img done
region.get_address()=0x7f8f9750d000
region.get_size()=1600048
p_set=0x7f8f9750d000
p_values=0x7f8f9750d020
created/inserted 50000 entries
region.get_address()=0x7f8f9750d000
region.get_size()=1600048
p_set=0x7f8f9750d000
p_values=0x7f8f9750d020
checked 50000 entries

real 0m1.890s
user 0m1.844s
sys 0m0.012s

$ time ./avltest-oo
sizeof(BalanceNode)=32
sizeof(BalanceSet)=32
creating file /tmp/avltest.img done
region.get_address()=0x7fb9e3b2d000
region.get_size()=1600048
p_set=0x7fb9e3b2d000
p_values=0x7fb9e3b2d020
created/inserted 50000 entries
region.get_address()=0x7fb9e3b2d000
region.get_size()=1600048
p_set=0x7fb9e3b2d000
p_values=0x7fb9e3b2d020
checked 50000 entries

real 0m0.248s
user 0m0.144s
sys 0m0.016s

Lothar

-- 
Lothar Werzinger Dipl.-Ing. Univ.
framework & platform architect
Tradescape Inc. - Enabling Efficient Digital Marketplaces
1754 Technology Drive, Suite 128
San Jose, CA 95110
email: lothar_at_[hidden]
web: http://www.tradescape.biz



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net