Skip to content

Very slow broadcast #560

Closed
Closed
@dkarrasch

Description

@dkarrasch

At SciML/OrdinaryDiffEq.jl#571 an instance of very slow broadcast was identified:

using BenchmarkTools, StaticArrays

f(ũ, u₀, u₁, ρ) = ũ ./ (1e-6 .+ max.(abs.(u₀), abs.(u₁)) .* ρ)
ũ, u₀, u₁, ρ = rand(3), rand(3), rand(3), rand(3)
@btime f($ũ, $u₀, $u₁, $ρ) # 47.473 ns (1 allocation: 112 bytes)

ũ, u₀, u₁, ρ = rand(SVector{3}), rand(SVector{3}), rand(SVector{3}), rand(SVector{3})
@btime f($ũ, $u₀, $u₁, $ρ) # 2.354 μs (44 allocations: 3.59 KiB)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions