|
Boost Users : |
From: Vladimir Prus (vladimir_at_[hidden])
Date: 2008-07-10 11:08:55
SD wrote:
>> > # Create libtest.so
>> > g++ -shared -fPIC test.cpp -o libtest.so
>> > # link boost_regex before libtest.so
>> > g++ main.cpp -lboost_regex${BOOST_EXT} -ltest -L${PWD} -o main_fast
>> > # link boost_regex after libtest.so
>> > g++ main.cpp -ltest -lboost_regex${BOOST_EXT} -L${PWD} -o main_slow
>> >
>> > time env LD_LIBRARY_PATH=${PWD} ./main_slow
>> > # real 0m0.753s, user 0m0.746s, sys 0m0.004s
>> > time env LD_LIBRARY_PATH=${PWD} ./main_fast
>> > # real 0m0.104s, user 0m0.103s, sys 0m0.002s
>> >
>> > As the results show the order which libs are being linked to the program
>> > has significant performance impacts on execution time: main_fast is
>> > about 7 times faster than main_slow.
>> ....
>> > I would appreciate if someone could explain these surprising results.
>>
>> Before we go on guessing what could cause this -- do you get the same timings
>> on successive runs of any given executable?
>
> Yes, the runtimes vary only minimally.
Does running ldd on both binaries report that the same boost_regexp binary
is being linked to? I don't see why different ones would be linked to, but
still.
If this theory is wrong, can you create a self-contained archive with all
the necessary files, and send it, so that I (and others) can try to reproduce.
This sounds truly bizarre.
- Volodya
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