Jump to content
  • Advertisement
Sign in to follow this  

Lambda overhead on MSVC++ 2010?

This topic is 2029 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I believe the actual overhead is located in std::function, and it seems to be possible to use template functions and avoid the use of std::function (since i dont need to store the lambdas, only pass them as arguments) completely, which should get rid of the overhead associated with it.
Assuming nothing weird pops up, this can be considered solved.
Hey, im using lambdas in many performance critical sections of my code.

The profiler i use indicates that the lambdas would be responsible for practically all allocations and frees that happen while its running (i dont think im interpreting it wrong, because i had some other allocations taking most of the time before i eliminated them)

After some googling, i have come to believe that if the capture list values take more than 12 bytes on this version of MSVC++, it will allocate them on the heap.

As a workaround, google suggests stuffing all the local vars and refs to a struct and capturing a reference to that.

I also found some stuff about std::function doing a pile of unnecessary copies... any solution for that?

What should i do?

Any easy non-haxy workarounds, or should i change platform (MSVC++ 2012 if there hasnt been any terrible changes, or something that uses some windows version of GCC i guess?) Edited by Waterlimon

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!