Skip to content

gmain: avoid a GList traversal when removing source

Christian Hergert requested to merge wip/chergert/queue-for-sourcelist into main

Currently the GSourceList has it's own allocation plus a secondary allocation for the GList which contains it (from GMainContext). Not only are these a pointer chase, but they are on separate cachelines too. Without changing the code much we can at least keep things on the same cacheline so that the pointer chase matters less.

Since the GList becomes embedded in the GSourceList you can use a g_queue_unlink() directly removing the link without traversing the GList like was done before.

Furthermore, we can simplify some code with g_queue_push_tail_link() instead of some extra branching.

Merge request reports