Skip to content

Slow in assignment of boolean arrays #218

Open
@RainerHeintzmann

Description

@RainerHeintzmann

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions