# Impact of specifying input types on function performance, when referencing arguments from Vector{Any}

**URL:** <https://discourse.julialang.org/t/impact-of-specifying-input-types-on-function-performance-when-referencing-arguments-from-vector-any/89993>\
**Category:** Performance\
**Created:** [November 9, 2022, 3:39pm UTC](https://discourse.julialang.org/t/impact-of-specifying-input-types-on-function-performance-when-referencing-arguments-from-vector-any/89993 "2022-11-09T15:39:11Z")\
**Posts on this page:** 1\
**Showing post:** 18

<div class="post-metadata">

**Author:** ![lmiq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmiq/32/18314_2.png) [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Post date:** [November 10, 2022, 1:07pm UTC](https://discourse.julialang.org/t/impact-of-specifying-input-types-on-function-performance-when-referencing-arguments-from-vector-any/89993/18 "2022-11-10T13:07:58Z")

</div>

Indeed, the problem boils down to having a vector typed with an abstract type, in this case. In some situations that can be avoided by using a tuple (if the vector is small). In other cases that is inherently difficult to solve (operating on containers of abstract types is the hardest thing to optimize, probably), and require sometimes rethinking the structure of the problem to avoid those containers at all.

One of these threads can lead you to long discussions about this last kind of problem: [Performance drawback with subtyping](https://discourse.julialang.org/t/performance-drawback-with-subtyping/51939)

(there is no easy and general solution)

---

_[View the full topic](https://discourse.julialang.org/t/impact-of-specifying-input-types-on-function-performance-when-referencing-arguments-from-vector-any/89993)._
