# How to use differently sized static arrays per project

**URL:** <https://discourse.julialang.org/t/how-to-use-differently-sized-static-arrays-per-project/62834>\
**Category:** General Usage\
**Tags:** question\
**Created:** [June 13, 2021, 1:26pm UTC](https://discourse.julialang.org/t/how-to-use-differently-sized-static-arrays-per-project/62834 "2021-06-13T13:26:38Z")\
**Posts on this page:** 1\
**Showing post:** 8

<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:** [June 13, 2021, 7:28pm UTC](https://discourse.julialang.org/t/how-to-use-differently-sized-static-arrays-per-project/62834/8 "2021-06-13T19:28:00Z")

</div>

Exactly. If one the input parameters contain the size as a type parameter, use something like:

> [@ufechner7](#):
>
> ```julia
> function residual!(res, yd, y, p::SVector{N,T}, time) where N,T
> pos = SVector{N+1}(...)
> 
> ```

and then it may become non allocating. The point is to make the function specialize to a given N, and then these sizes are known at compile time, even if not apparently constant for the user.

(“particles” in my field are usually on the thousands, so that is why I asked. But with those sizes that is fine)

Ps. For example: [Question about allocations and generators - #3 by lmiq](https://discourse.julialang.org/t/question-about-allocations-and-generators/62693/3)

---

_[View the full topic](https://discourse.julialang.org/t/how-to-use-differently-sized-static-arrays-per-project/62834)._
