We need to refactor the C++ API to avoid passing function objects by value.
Currently, functions like async accept their function object arguments by value, which results in a lot of extra copies. For a typical async (see test copies0), there are two or three extra copies. When using the forasync family of functions, the issue is much worse, with thousands of unneeded copies for a single 3D loop in from of our tests (see test copies1).
We need to refactor the C++ API to avoid passing function objects by value.
Currently, functions like
async
accept their function object arguments by value, which results in a lot of extra copies. For a typicalasync
(see test copies0), there are two or three extra copies. When using theforasync
family of functions, the issue is much worse, with thousands of unneeded copies for a single 3D loop in from of our tests (see test copies1).