specialize Function internals over trivially-copyable callables
Summary: `Function` requires an instantiation of a control function for every unique callable type. There are two control functions, named `execSmall` and `execBig`. But instantiation is expensive for build speed and build size - especially instantiation per unique callable type. An hypothesis is that it is common for callable types to be trivially-copyable. In particular, that it is common to have lambdas with implicit by-reference captures and no other captures, as `[&] { /* ... */ }`. So we introduce a new dispatch class, `DispatchSmallTrivial`, with a member function `exec` which is instantiated as few times as possible and which is used for all trivially-copyable callable types. Reviewed By: ot, luciang Differential Revision: D32932586 fbshipit-source-id: 34ecad6b6bcbbc3ed379e3d32babf04c91d76557
Showing
Please register or sign in to comment