AK
Size: a a a
AK
АО
AK
RS
AK
АО
АО
RS
RS
АО
АО
АО
ЕП
ЕП
RS
RS
ЕП
УМ
АО
using BenchmarkTools
f1(x) = hcat(first.(x), last.(x))
function f2(x)
res = Matrix{Int}(undef, length(x), 2)
@inbounds for i in eachindex(x)
res[i, 1] = first(x[i])
res[i, 2] = last(x[i])
end
return res
end
v = [1:10, 15:20, 30:40]
julia> @btime f1($v)
90.451 ns (3 allocations: 352 bytes)
julia> @btime f2($v)
29.326 ns (1 allocation: 128 bytes)
АО