# What is the fastest, vector or array?

**URL:** <https://discourse.julialang.org/t/what-is-the-fastest-vector-or-array/79399>\
**Category:** Performance\
**Tags:** question\
**Created:** [April 12, 2022, 5:20pm UTC](https://discourse.julialang.org/t/what-is-the-fastest-vector-or-array/79399 "2022-04-12T17:20:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Leticia-maria](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/leticia-maria/32/30981_2.png) [@Leticia-maria](https://discourse.julialang.org/u/Leticia-maria)\
**Post date:** [April 12, 2022, 5:20pm UTC](https://discourse.julialang.org/t/what-is-the-fastest-vector-or-array/79399/1 "2022-04-12T17:20:47Z")

</div>

Hi there, I would like to know what do you think about the performance of different types: vector and array. Whic one is the fastest?

---

<div class="post-metadata">

**Author:** ![goerch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/goerch/32/29122_2.png) [@goerch](https://discourse.julialang.org/u/goerch)\
**Post date:** [April 12, 2022, 5:25pm UTC](https://discourse.julialang.org/t/what-is-the-fastest-vector-or-array/79399/2 "2022-04-12T17:25:43Z")

</div>

`Vector` is a [special cased](https://github.com/JuliaLang/julia/blob/bb5b98e72a151c41471d8cc14cacb495d647fb7f/base/array.jl#L60) `Array`.

---

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [April 12, 2022, 5:29pm UTC](https://discourse.julialang.org/t/what-is-the-fastest-vector-or-array/79399/3 "2022-04-12T17:29:10Z")

</div>

You can also check that they’re exactly the same like this:

```julia
julia> Vector{Int} === Array{Int, 1}
true

julia> Matrix{Int} === Array{Int, 2}
true

```

using `===` which checks that the two argument are exactly identical according to Julia.

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [April 13, 2022, 8:36pm UTC](https://discourse.julialang.org/t/what-is-the-fastest-vector-or-array/79399/4 "2022-04-13T20:36:24Z")

</div>

For small arrays (rule of thumb: less that 100 elements) [https://github.com/JuliaArrays/StaticArrays.jl](https://github.com/JuliaArrays/StaticArrays.jl) can give a large performance benefit…

---

<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:** [April 13, 2022, 8:42pm UTC](https://discourse.julialang.org/t/what-is-the-fastest-vector-or-array/79399/5 "2022-04-13T20:42:18Z")

</div>

Only if the array sizes are fixed (ideally, known statically). You wouldn’t use StaticArrays for a variable-sized container.
