<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>>> 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>>> I'd run the example code through Callgrind (valgrind --tool=callgrind) </div><div>>> and then compare the reports in KCachegrind. This should at least give </div><div>>> 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>>> Maybe trying another compiler would help you obtain your "proof".</div><div>>> How about intel compiler? </div><div>>> 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]" <steven.seeger@nasa.gov> 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@lists.boost.org >http://lists.boost.org/mailman/listinfo.cgi/boost-users </pre></div><br><br><span title="neteasefooter"><span id="netease_mail_footer"></span></span>