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

**URL:** <https://discourse.julialang.org/t/what-is-the-most-performant-way-to-create-an-array-of-functions/124055>\
**Category:** Performance\
**Created:** [December 21, 2024, 9:42am UTC](https://discourse.julialang.org/t/what-is-the-most-performant-way-to-create-an-array-of-functions/124055 "2024-12-21T09:42:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![stefkuypers](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefkuypers/32/19185_2.png) [@stefkuypers](https://discourse.julialang.org/u/stefkuypers)\
**Post date:** [December 21, 2024, 9:42am UTC](https://discourse.julialang.org/t/what-is-the-most-performant-way-to-create-an-array-of-functions/124055/1 "2024-12-21T09:42:23Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Post date:** [December 21, 2024, 9:44am UTC](https://discourse.julialang.org/t/what-is-the-most-performant-way-to-create-an-array-of-functions/124055/2 "2024-12-21T09:44:44Z")

</div>

[GitHub - JuliaLang/FunctionWrappers.jl: Type stable and efficient wrapper of arbitrary Julia functions](https://github.com/JuliaLang/FunctionWrappers.jl) perhaps?

---

<div class="post-metadata">

**Author:** ![Salmon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/salmon/32/22968_2.png) [@Salmon](https://discourse.julialang.org/u/Salmon)\
**Post date:** [December 21, 2024, 10:58am UTC](https://discourse.julialang.org/t/what-is-the-most-performant-way-to-create-an-array-of-functions/124055/3 "2024-12-21T10:58:56Z")

</div>

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.

> **[Methods · The Julia Language](https://docs.julialang.org/en/v1/manual/methods/#Function-like-objects)**
>
> Documentation for The Julia Language.
