<div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div>Hi, there,</div><div>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.</div><div>First of all, I wanna reply the guys who give me hints.</div><div><br></div><div>&gt;&gt; What if you try with just 1 integer? Does the difference in time stay proportionally the same?</div><div>There won't be big differences if there is just 1 integer. So this proofs that it could be a memory copy problem.</div><div><br></div><div>&gt;&gt; I'd run the example code through Callgrind (valgrind --tool=callgrind)&nbsp;</div><div>&gt;&gt; and then compare the reports in KCachegrind. This should at least give&nbsp;</div><div>&gt;&gt; you an idea of the source of the problem.</div><div>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.</div><div><br></div><div>&gt;&gt; Maybe trying another compiler would help you obtain your "proof".</div><div>&gt;&gt; How about intel compiler?&nbsp;</div><div>&gt;&gt; It also has the "-std=c++11" flag, so, if it is a compiler issue it will be clear.</div><div>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.</div><div><br></div><div>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.</div><div><br></div><div>Thanks</div><div>Athrun</div><br><br><div></div><div id="divNeteaseMailCard"></div><br><pre><br>At 2014-07-05 11:32:21, "Seeger, Steven D. (GSFC-444.0)[Embedded Flight Systems, Inc]" &lt;steven.seeger@nasa.gov&gt; wrote:
&gt;&gt;Right, there are 1000 integers in the vector. If something, say STL, is bottleneck for boost::bind with C++ 11, it &gt;should also be a bottleneck without C++11. And they should have the same performance. However, the fact shows &gt;that C++11 mode has some additional overhead. I wanna figure that out.
&gt;
&gt;What if you try with just 1 integer? Does the difference in time stay proportionally the same?
&gt;
&gt;Steven
&gt;_______________________________________________
&gt;Boost-users mailing list
&gt;Boost-users@lists.boost.org
&gt;http://lists.boost.org/mailman/listinfo.cgi/boost-users
</pre></div><br><br><span title="neteasefooter"><span id="netease_mail_footer"></span></span>