Closed odlomax closed 1 year ago
Nice improvements! I like that you don't have the
arrayViewsCopy
anymore.
Thanks, Willem. Your suggestions make the code a lot cleaner (and hopefully more readable). I think I know how forwarding works now!
FYI, before you go deeper, I have already finished working on a field::for_each API. I was just about to create a PR, but then you dropped this. I'll have to reintegrate.
to create
Whoops, I hope I didn't create much more work. I think I've gone more than deep enough!
Hi @wdeconinck,
I've found that the array ForEach method is particularly slow when processing small arrays (tested on N = 100). I believe this is because processing
execution_policy
configs has a relatively high amount overhead.I've done a couple of things to alleviate this: 1) allowed
constexpr
policy selection when you provide anexecution_policy
object. 2) implemented perfect forwarding on the ArrayView objects (I don't think this did much, but it was useful to learn how to do it!)I've added two performance tests : 1)
nested
performs aForEach
over the 50000 columns and another ForEach over the 100 levels. Execution policy selection isconstexpr
. 2)nested, config
. Does the same as above, but determines the policy via a config.As you can see, the benefit of using a
constexpr
execution policy is quite dramatic when performing a large number calls on small array sizes.Thankfully, the config overhead is negligible when dealing with normal-sized NWP fields.
The only (intended) change to the interface is that you can now supply ArrayViews to the ForEach::Apply method using
std::tie
andstd::forward_as_tuple
as well asstd::make_tuple
.closes #134