Open
Description
Using LazyArrays.jl
, I found a speed problem with the assignment of arrays of Bool:
using BenchmarkTools, LazyArrays
x = 1:2000 .< 1000
y = (1:1900)' .< 1000
a = x .* y;
@btime a .= $x .* $y; # 2.8 ms
la = LazyArray(@~ x .* y);
@btime a = collect($la); # 2.6 ms
@btime a .= $la; # 30.8 ms (Problem!)
as can be seen, the last assignment, which indeed uses very little memory is much (>10x) slower than collecting the LazyArray, which should have the additional costs of memory allocation.
Metadata
Metadata
Assignees
Labels
No labels