Boost logo

Boost Users :

Subject: Re: [Boost-users] boost::function performance issues with C++11
From: ·¹Í° (athrun911500_at_[hidden])
Date: 2014-07-07 20:28:02


Hi, there,
Thanks for you guys help. I think I have reached the answer I wanted. So I'd like to explain why there are performance issues with C++11 in boost::function.
First of all, I wanna reply the guys who give me hints.

>> What if you try with just 1 integer? Does the difference in time stay proportionally the same?
There won't be big differences if there is just 1 integer. So this proofs that it could be a memory copy problem.

>> I'd run the example code through Callgrind (valgrind --tool=callgrind)
>> and then compare the reports in KCachegrind. This should at least give
>> you an idea of the source of the problem.
You are right. I ran callgrind, and it showed some interesting things. If I compiled without C++11, it shows the most hot spot is "wordcopy_fwd_align". Otherwise, the most hotspot is "boost::bind" and there is no records for wordcopy_fwd_align. I think that means if we dont' use C++11, there will be some memory copy optimizations.

>> Maybe trying another compiler would help you obtain your "proof".
>> How about intel compiler?
>> It also has the "-std=c++11" flag, so, if it is a compiler issue it will be clear.
As you suggested, I tried Intel compiler. It's great. The data shows there is no performance differences between with or without C++11 in boost::function. That proofs your guess that it's a compiler issue.

So here is my conclusion, there won't be memory copy optimization when using (C++11, boost::function, gcc4.9/clang3.4). But Intel compiler does well to do C++11 related optimizations.

Thanks
Athrun

At 2014-07-05 11:32:21, "Seeger, Steven D. (GSFC-444.0)[Embedded Flight Systems, Inc]" <steven.seeger_at_[hidden]> wrote:
>>Right, there are 1000 integers in the vector. If something, say STL, is bottleneck for boost::bind with C++ 11, it >should also be a bottleneck without C++11. And they should have the same performance. However, the fact shows >that C++11 mode has some additional overhead. I wanna figure that out.
>
>What if you try with just 1 integer? Does the difference in time stay proportionally the same?
>
>Steven
>_______________________________________________
>Boost-users mailing list
>Boost-users_at_[hidden]
>http://lists.boost.org/mailman/listinfo.cgi/boost-users



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