Static Arrays in pure Julia

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!!

1 Like

First, the StaticArrays package is already pure Julia code.

Second, StaticArrays aren’t a panacea — as I pointed out recently in another thread, 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”.

18 Likes

An alternative to StaticArrays is AbstractTensors.jl combined with Grassmann.jl. It’s an experiment where I am trying to build a new foundation for mathematixs in Julia language.

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

5 Likes