habanero-rice / hclib

A C/C++ task-based programming model for shared memory and distributed parallel computing.
http://habanero-rice.github.io/hclib/
BSD 3-Clause "New" or "Revised" License
71 stars 35 forks source link

Excessive copies of lambdas #17

Open DaoWen opened 8 years ago

DaoWen commented 8 years ago

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).