As @2419 wrote, what you are getting with x=[1 2 3 4 5 6] is actually a one-row matrix, and Julia is more performant with column vectors.
That's said, there are of course legit uses of matrices ;-)
Here is the long story.. when you have a matrix and slice it such that the result is a single row, it is automatically converted to a column vector:
julia> x = [1 2 3 4; 10 20 30 40; 100 200 300 400]
3×4 Matrix{Int64}:
1 2 3 4
10 20 30 40
100 200 300 400
julia> a = x[2,:]
4-element Vector{Int64}:
10
20
30
40
However if you slice it to 2 or more rows, it remains a Matrix:
julia> b = x[[2,3],:]
2×4 Matrix{Int64}:
10 20 30 40
100 200 300 400
I feel myself a bit perplex with this choice, but it is like this, and it will not change now.
Note that to retrieve back a row vector with the first case it is very easy:
julia> transpose(a) # or, equivalently, `a'`
1×4 transpose(::Vector{Int64}) with eltype Int64:
10 20 30 40
Important! transpose is a matrix operation and works only with numerical matrices (or vectors).
If your matrix includes non-numerical elements, as strings, transpose would generate an error and you should instead use permutedims:
julia> x2 = [1 2 "c" 4; 10 20 "cc" 40; 100 200 300 "ddd"]
3×4 Matrix{Any}:
1 2 "c" 4
10 20 "cc" 40
100 200 300 "ddd"
julia> a2 = x2[2,:]
4-element Vector{Any}:
10
20
"cc"
40
julia> transpose(a2)
1×4 transpose(::Vector{Any}) with eltype Any:
Error showing value of type LinearAlgebra.Transpose{Any, Vector{Any}}:
ERROR: MethodError: no method matching transpose(::String)
# [...]
julia> permutedims(a2)
1×4 Matrix{Any}:
10 20 "cc" 40
However transpose is faster:
julia> using BenchmarkTools
julia> @btime transpose(a)
21.971 ns (1 allocation: 16 bytes)
1×4 transpose(::Vector{Int64}) with eltype Int64:
10 20 30 40
julia> @btime permutedims(a)
66.289 ns (2 allocations: 96 bytes)
1×4 Matrix{Int64}:
10 20 30 40
So, if you are sure your matrix is numerical, use transpose, otherwise use permutedims.