To be sure, I benchmarked and it appears that creating the `view`

is not a problem, the costs are stemming from broadcasting:

```
yy = rand(2, 10000)
y = rand(2)
using BenchmarkTools
function f5(yy, x)
for i in 1:size(yy, 2)
y = Slice1(yy, i)
for k in eachindex(x)
@inbounds y[k] = x[k]
end
end
end
function f6(yy, x)
for i in 1:size(yy, 2)
y = view(yy, :, i)
for k in eachindex(x)
@inbounds y[k] = x[k]
end
end
end
@btime f5($yy, $y)
@btime f6($yy, $y)
25.072 μs (0 allocations: 0 bytes)
27.160 μs (0 allocations: 0 bytes)
```

with

```
struct Slice1{T} <: AbstractVector{T}
S::Matrix{T}
idx::Int
sz::Base.OneTo{Int}
end
@inline function Slice1(A::TA, i::Int) where {TA<:AbstractArray{T,2}} where {T}
Slice1(A, i, Base.OneTo(size(A)[1]) )
end
@inline size(S::Slice1) = (length(S.sz),)
@inline axes(S::Slice1) = (S.sz,)
@inline Base.IndexStyle(::Type{<:Slice1}) = IndexLinear()
@inline function setindex!(S::Slice1, x, k)
@boundscheck checkbounds(S.S, k, S.idx)
@inbounds S.S[k, S.idx] = x
end
```