# Array of functions - is there a way to avoid allocations performance penalty?

**URL:** <https://discourse.julialang.org/t/array-of-functions-is-there-a-way-to-avoid-allocations-performance-penalty/24471>\
**Category:** Performance\
**Tags:** memory-allocation, arrays\
**Created:** [May 22, 2019, 11:29am UTC](https://discourse.julialang.org/t/array-of-functions-is-there-a-way-to-avoid-allocations-performance-penalty/24471 "2019-05-22T11:29:51Z")\
**Posts on this page:** 1\
**Showing post:** 15

<div class="post-metadata">

**Author:** ![chakravala](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chakravala/32/6832_2.png) [@chakravala](https://discourse.julialang.org/u/chakravala)\
**Post date:** [May 22, 2019, 3:37pm UTC](https://discourse.julialang.org/t/array-of-functions-is-there-a-way-to-avoid-allocations-performance-penalty/24471/15 "2019-05-22T15:37:15Z")

</div>

In my case, it is needed for encoding the metric at a tangent space of a Riemannian manifold in differential geometry

> [@\[ANN\] DirectSum.jl, AbstractTensors.jl : dispatch on VectorBundle \<: Manifold{n}](https://discourse.julialang.org/t/ann-directsum-jl-abstracttensors-jl-dispatch-on-vectorspace/20870/4):
>
> The DirectSum package has a tangent bundle encoding based on the following: Let T^dV\in\text{Vect}\_\mathbb K be a VectorBundle\<:Manifold of rank n, T^dV = (n,p,g,d),\, n \in\mathbb N,\, g :V\times V\rightarrow\mathbb K, \, d \in\mathbb Z ::VectorBundle{n,p,g,d} where {n,p,g,d} byte-encoded p specifies the null-basis from the projective split of V, g is a bilinear form that specifies the metric of the space, d is an integer specifying the order of the tangent bundle. \bigoplus T^{d…

The Hodge star requires evaluating a volume element of a submanifold using the metric at a particular point, which is currently considered constant and will be generalized to a `FunctionWrapper` next.

---

_[View the full topic](https://discourse.julialang.org/t/array-of-functions-is-there-a-way-to-avoid-allocations-performance-penalty/24471)._
