-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Closed
Labels
GCGarbage collectorGarbage collectorregressionRegression in behavior compared to a previous versionRegression in behavior compared to a previous version
Description
When looking into #49120, it seems the regression seen there was hiding a part of the new mark loop where it's slower when marking a very large array of pointers.
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")
@time GC.gc()
@time GC.gc()
One of the GCs after will do a full mark of the array and take a long time to do it. This probably wasn't seen before because arrays of many pointers had really bad GC behaviour overall, but with #49185 it's quite clear.
Metadata
Metadata
Assignees
Labels
GCGarbage collectorGarbage collectorregressionRegression in behavior compared to a previous versionRegression in behavior compared to a previous version