Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slow in assignment of boolean arrays #218

Open
RainerHeintzmann opened this issue Aug 20, 2022 · 0 comments
Open

Slow in assignment of boolean arrays #218

RainerHeintzmann opened this issue Aug 20, 2022 · 0 comments

Comments

@RainerHeintzmann
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant