I want to subtract a Matrix from a Vector of Matrix. For Example, In below defined variable i want to subtract y for each element of xl
xl = [Matrix{Float64}(undef, 2, 3) for i in 1:1000]
y = Matrix{Float64}(undef, 2, 3)
I know this can be done with map function
map(x -> x-y, xl)
But is there any better way to do this or can we reduce runtime by multithreading? I tried benchmarking simple map and ThreadsX.map and found ThreadsX.map is slower any suggestion to reduce runtime.
@btime map(x -> x-y, xl); # 55.558 μs (1010 allocations: 117.59 KiB)
@btime ThreadsX.map(x -> x-y, xl); # 99.764 μs (5414 allocations: 285.47 KiB)
Note: Here Matrix is just an example I want to do this on large vector of custom struct that support subtraction.