.. broadcast object property

For complete reductions, I think this already works, although I thought it was faster:

julia> @btime sum(v .* v')  setup=(v=ones(100))
  6.286 μs (2 allocations: 78.20 KiB)
10000.0

julia> @btime sum(Broadcast.Broadcasted(*,(v,v')))  setup=(v=ones(100))
  38.672 μs (0 allocations: 0 bytes)
10000.0

Issue about the syntax: https://github.com/JuliaLang/julia/issues/19198 which led to LazyArrays @~, with which:

julia> using LazyArrays

julia> @btime sum(@~ v .* v')  setup=(v=ones(100))
  30.671 μs (0 allocations: 0 bytes)
10000.0

julia> @btime sum(LazyArray(@~ v .* v'))  setup=(v=ones(100))
  1.841 μs (0 allocations: 0 bytes)
10000.0
2 Likes