Skip to content

Broadcasting with missings is slow #30455

Closed
@cstjean

Description

@cstjean

This might just be #28126, but it looks like a separate problem. On 1.0.2:

julia> using BenchmarkTools

julia> v = fill(2.0, 50000);

julia> v2 = vcat(v, missing);

julia> v3 = vcat(missing, v);

julia> @btime $v .* 3.0;
  33.105 μs (2 allocations: 390.70 KiB)

julia> @btime $v2 .* 3.0;
  1.610 ms (99498 allocations: 2.33 MiB)

julia> @btime $v3 .* 3.0;
  3.867 ms (7 allocations: 439.77 KiB)

Apart from the 40X performance difference, two things stand out:

  • 99498 allocations for v2. Why?
  • Why is v3 slower than v2, in spite of allocating much less?

Metadata

Metadata

Assignees

No one assigned

    Labels

    broadcastApplying a function over a collectionmissing dataBase.missing and related functionalityperformanceMust go faster

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions