Skip to content

Commit

Permalink
filter out empty WeakRefs much less often
Browse files Browse the repository at this point in the history
drastically improves performance of large listviews
  • Loading branch information
jwahlstrand committed May 29, 2024
1 parent ac17def commit c184328
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/GLib/gtype.jl
Original file line number Diff line number Diff line change
Expand Up @@ -324,14 +324,16 @@ function run_delayed_finalizers()
exiting[] && return # unnecessary to cleanup if we are about to die anyways
g_yielded[] && return # can't run them right now
topfinalizer[] = false
if !isempty(await_finalize) # only do this once when we're doing GC stuff
# prevents empty WeakRefs from filling gc_preserve_glib
gc_preserve_glib_lock[] = true
filter!(x->!(isa(x.first,WeakRef) && x.first.value === nothing),gc_preserve_glib)
gc_preserve_glib_lock[] = false
end
while !isempty(await_finalize)
x = pop!(await_finalize)
finalize_gc_unref(x)
end
# prevents empty WeakRefs from filling gc_preserve_glib
gc_preserve_glib_lock[] = true
filter!(x->!(isa(x.first,WeakRef) && x.first.value === nothing),gc_preserve_glib)
gc_preserve_glib_lock[] = false
topfinalizer[] = true
end

Expand Down

0 comments on commit c184328

Please sign in to comment.