Home Dashboard Directory Help
Search

std::bind and std::function generate a crazy number of copy. by Thomas Petit


Status: 

Closed
 as Fixed Help for as Fixed


2
0
Sign in
to vote
Type: Bug
ID: 649268
Opened: 3/3/2011 4:19:25 PM
Access Restriction: Public
0
Workaround(s)
view
0
User(s) can reproduce this bug

Description

Running the snippet below we can see that, even in release, a simple use of std::bind and std::function with a struct leads to *ten* calls to the copy constructor of that structure !

Such hidden performance penalty hit was very surprising to me. For example, GCC 4.6 with the same code generate only one call to the copy constructor (for std::bind) then one call to the move constructor (for std::function), which is the expected behavior.
Details
Sign in to post a comment.
Posted by Microsoft on 6/28/2011 at 6:17 PM
Hi,

Thanks for reporting this bug. We've fixed it, and the fix will be available in VC11.

If you have any further questions, feel free to E-mail me at stl@microsoft.com .

Stephan T. Lavavej
Visual C++ Libraries Developer
Posted by Microsoft on 3/3/2011 at 10:46 PM
Thank you for submitting feedback on Visual Studio 2010 and .NET Framework. Your issue has been routed to the appropriate VS development team for review. We will contact you if we require any additional information.
Posted by Microsoft on 3/3/2011 at 5:15 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.