DARMA-tasking-internal / darma-frontend

Header library providing the frontend programming model for the DARMA asynchronous many-task model
Other
7 stars 0 forks source link

Switch from using lambdas to using functors in keyword argument parser usage to reduce compile time #66

Open dhollman opened 6 years ago

dhollman commented 6 years ago

As far as I can tell (and we should benchmark this), creating a lambda inline inside of a function template causes a new (anonymous) class to be created for every different template instantiation of the function (also applies to method templates). In the case of the use with our keyword argument parser, the whole point is to turn a disparate set of function template invocations and argument orderings into a uniform ordering that's easy to work with (and hence a much smaller number of template instantiations). Even though it's less readable to use an out-of-line functor with a (potentially templated) call operator for the content of the function template (as is done, say, in initial_access), we should see a substantial difference in compile times for programs that invoke the function template with hundreds of different argument types and orderings thereof.

dhollman commented 6 years ago

@giulioborghesi Can you create a few simple test cases that verify this change improves compile times?

Actually, more generally, can you set up some simple infrastructure — CMake targets, etc. — to easily add compilation-time benchmarks and tests to the DARMA frontend repo? (I'll create a separate issue for this one).

dhollman commented 6 years ago

We should wait until #67 is ready before we do this

giulioborghesi commented 6 years ago

Will do