Identical method redefinition suspiciously optimizes runtime and allocations

Too quick to disrespect StaticArrays.jl :sweat_smile:

After a few hours I’m still not able to make a PR to StaticArrays.jl to fix the issue. Some observations:

  • The input array to all is a nested static array, with static arrays as elements. This complicates the recursion, making inference give up.

  • The all for Tuple does not have to support a dims argument, simplifying the problem.

My conclusion, for now, is to convert static arrays to tuples as eagerly as possible.

I guess the important thing about the workaround is that the conversion to tuple happens before any all(f, c) call.

2 Likes