Skip to content

v1.9 rc1 significant slowdown in garbage collection #49120

@denglerchr

Description

@denglerchr

I have a significant slowdown for some code in Julia 1.9 rc1 which I could track down to garbage collection during filling of arrays. There seems to be something fishy with v1.9 rc1.
Below is some reduced code to reproduce the issue. The garbage collection is here significantly slower for Julia 1.9 compared to previous versions.
Total runtime for ´julia test.jl' on my machine is

  • around 5 s for Julia 1.8
  • around 94 s for Julia 1.9
using Random: seed!
seed!(1)

abstract type Cell end

struct CellA<:Cell
    a::Int
end

struct CellB<:Cell
    b::String
end

function fillcells!(mc::Array{Cell})
    for ind in eachindex(mc)
        mc[ind] = ifelse(rand() > 0.5, CellA(ind), CellB(string(ind)))
    end
    return mc
end

mcells = Array{Cell}(undef, 5000, 5000 )
t1 = @elapsed fillcells!(mcells)
t2 = @elapsed fillcells!(mcells)

println("filling: $t1 s\nfilling again: $t2 s")

I saw some GC issues in #48923 , not sure if this is related. If so, let me know and I will close this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    GCGarbage collectorregressionRegression in behavior compared to a previous version

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions