# Static Arrays in pure Julia

**URL:** https://discourse.julialang.org/t/static-arrays-in-pure-julia/46030
**Category:** Performance
**Tags:** package, performance, array
**Created:** [September 3, 2020, 10:52pm UTC](https://discourse.julialang.org/t/static-arrays-in-pure-julia/46030 "2020-09-03T22:52:55Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Renan\_Rabelo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/renan_rabelo/32/8048_2.png) [@Renan\_Rabelo](https://discourse.julialang.org/u/Renan_Rabelo)
#### Post date: [September 3, 2020, 10:52pm UTC](https://discourse.julialang.org/t/static-arrays-in-pure-julia/46030/1 "2020-09-03T22:52:55Z")

</div>

Before Julia I used to code in Java, and Java has static arrays (immutable size).

I know for sure that static arrays are way faster than dynamic ones, so how can I use they in pure Julia?

I found a package called “StaticArrays” and it says that StaticArrays can perform up to 25x faster than dynamic, so why does Julia don’t use this as a core feature?

As a bonus question: can you people recommend me packages for performance and for adding some important tools that Julia doesn’t offer in the standard library, like data structures, functions and so on. In special mathematical tools for optimization on algorithms.

Thanks!!

---

<div class="post-metadata">

### Author: ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)
#### Post date: [September 3, 2020, 11:01pm UTC](https://discourse.julialang.org/t/static-arrays-in-pure-julia/46030/2 "2020-09-03T23:01:51Z")

</div>

> [@Renan\_Rabelo](#):
>
> I found a package called “StaticArrays” and it says that StaticArrays can perform up to 25x faster than dynamic, so why does Julia don’t use this as a core feature?

First, the [StaticArrays package](https://github.com/JuliaArrays/StaticArrays.jl) is _already pure Julia code_.

Second, StaticArrays aren’t a panacea — as [I pointed out recently in another thread](https://discourse.julialang.org/t/julia-hangs-while-displaying-an-smatrix/45918/3), they are only good for problems involving lots of tiny arrays whose size is fixed at compile-time, and aren’t a good idea as a general-purpose container.

Third, one of the key design goals of Julia is that code does not have to be “built-in” to the core language to be fast — for the most part, the standard library has **no advantage over external packages** except being installed automatically. In particular, there is no performance advantage to being “built in”.

---

<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: [September 3, 2020, 11:22pm UTC](https://discourse.julialang.org/t/static-arrays-in-pure-julia/46030/3 "2020-09-03T23:22:17Z")

</div>

An alternative to `StaticArrays` is [AbstractTensors.jl](https://github.com/chakravala/AbstractTensors.jl) combined with [Grassmann.jl](https://github.com/chakravala/Grassmann.jl). It’s an experiment where I am trying to build a new foundation for mathematixs in Julia language.

> [@Help with simplified StaticArrays implementation](https://discourse.julialang.org/t/help-with-simplified-staticarrays-implementation/45522):
>
> Poblem: [StaticArrays.jl](https://github.com/JuliaArrays/StaticArrays.jl) is too large of a dependency and has too many extra features. To simplify my dependencies, I need a simplified variant of SVector, MVector, and SizedVector. Solution: In [AbstractTensors.jl](https://github.com/chakravala/AbstractTensors.jl) they are replaced with Values, Variables, and FixedVector. julia\> using AbstractTensors # loads 10x faster than StaticArrays julia\> a = Values(1,2,3) 3-element Values{3,Int64} with indices SOneTo(3): 1 2 3 My goal is to have an implementation that is robust as in StaticArrays b…

> [@Grassmann.jl A\\b 3x faster than Julia's StaticArrays.jl](https://discourse.julialang.org/t/grassmann-jl-a-b-3x-faster-than-julias-staticarrays-jl/41451/35):
>
> This was because of a special explicit case for dimensions 1 and 2 and 3, which are now accounted for in Grassmann.jl also. Also, support has been added for Moore-Penrose inverses for underdetermined and overdetermined linear systems. For underdetermined cases, the exterior product algorithm works ~20x faster than the SMatrix algorithm, and it is numerically stable. For overdetermined equations, the method used is based on the traditional normal equations, and this is prone to more numerical i…

The reason `StaticArrays` is not in `Base` is so that its version can be iterated seperately.
