# Splat on a vector uses allocations and not on a tuple

**URL:** <https://discourse.julialang.org/t/splat-on-a-vector-uses-allocations-and-not-on-a-tuple/3776>\
**Category:** General Usage\
**Created:** [May 17, 2017, 7:52pm UTC](https://discourse.julialang.org/t/splat-on-a-vector-uses-allocations-and-not-on-a-tuple/3776 "2017-05-17T19:52:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![wsshin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wsshin/32/360_2.png) [@wsshin](https://discourse.julialang.org/u/wsshin)\
**Post date:** [May 17, 2017, 7:52pm UTC](https://discourse.julialang.org/t/splat-on-a-vector-uses-allocations-and-not-on-a-tuple/3776/1 "2017-05-17T19:52:01Z")

</div>

In the following example, I am passing a set of subscripts `i, j, k` of a 3-dimensional array `A` in the form of vector `v = [i,j,k]` or tuple `t = (i,j,k)` using a splat `...`. I find that `A[v...]` uses 2 allocations whereas `A[t...]` doesn’t. This leads to much slower execution of `A[v...]` compared to `A[t...]`:

```julia
julia> VERSION
v"0.7.0-DEV.82"

julia> using BenchmarkTools

julia> v = [1,2,3]; t = (1,2,3); A = rand(3,3,3);

julia> @btime $A[$v...]
  81.003 ns (2 allocations: 32 bytes)
0.9645012234582633

julia> @btime $A[$t...]
  2.266 ns (0 allocations: 0 bytes)
0.9645012234582633

```

Why does `v...` need to use allocations? Is this something that can be fixed, or there is something fundamental in vectors that requires allocations?

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [May 17, 2017, 7:55pm UTC](https://discourse.julialang.org/t/splat-on-a-vector-uses-allocations-and-not-on-a-tuple/3776/2 "2017-05-17T19:55:13Z")

</div>

You don’t know how long they are.
