[a[i] for i in t]?
or
julia> @benchmark view($a, SVector($t))
BenchmarkTools.Trial: 10000 samples with 1000 evaluations.
Range (min … max): 2.584 ns … 8.786 ns ┊ GC (min … max): 0.00% … 0.00%
Time (median): 2.605 ns ┊ GC (median): 0.00%
Time (mean ± σ): 2.618 ns ± 0.136 ns ┊ GC (mean ± σ): 0.00% ± 0.00%
▁█▁
████▅▂▂▂▂▂▁▂▂▂▂▂▂▂▂▁▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▁▂▂▂▂▂▂ ▂
2.58 ns Histogram: frequency by time 3.17 ns <
Memory estimate: 0 bytes, allocs estimate: 0.