Fast-path destructor
Summary: Optimise the destruction of default-constructed and moved-out Function objects. Instead of calling a function pointer that is set to a no-op function, use `nullptr` to signal emptyness of that function pointer and check if it is `nullptr` before invoking. This adds additional branching in a few places: not only in the destructor, but also in the move constructor, as well as in the little used `hasAllocatedMemory`. The effect of getting rid of calls to a no-op function pointer should outweigh that. Reviewed By: djwatson Differential Revision: D8694003 fbshipit-source-id: 42972805b2ade255cf1dcc98e54985b1524daa73
Showing
Please register or sign in to comment