What is the most performant way to create an array of functions?

Is there a performant way to create an array of functions over which I can iterate? I’ve noticed that creating a Vector{Function}() has quite a performance hit due to the abstract Function type. I cannot use the concrete type of the functions though because the array contains more than 1 type of function.

GitHub - JuliaLang/FunctionWrappers.jl: Type stable and efficient wrapper of arbitrary Julia functions perhaps?

3 Likes

If your functions are all similar, i.e. they differ by a number of parameters (like different polynomials), functors can be great. theyre performant and pretty good for interfaces.

4 Likes