Files
glib/gobject
Thomas Haller 490604e6d1 gobject: add needs_notify flag per object for efficient lookup
The class of a GObject cannot change during its lifetime. And also the
the class itself not change (e.g. change the virtual methods).
As such, we can cache CLASS_NEEDS_NOTIFY() per object.

This way, our _g_object_has_notify_handler() only needs to compare the
flags, instead of fetching the class and check the vtable.

You might think, CLASS_NEEDS_NOTIFY() is cheaper to check, because it
doesn't need an atomic operation to fetch the class and compare the
vtable (unlike checking the object's optional-flags). You might also
think a constant flag should not be attached to the object's
optional-flags (which otherwise change). However, in all cases where we
care about CLASS_NEEDS_NOTIFY(), we anyway also check for
OPTIONAL_FLAG_HAS_NOTIFY_HANDLER which is right beside in the the
optional-flags. So having the OPTIONAL_FLAG_HAS_NEEDS_NOTIFY flag right
beside has no downside.
2025-04-03 18:13:39 +02:00
..
2023-10-16 23:34:04 +01:00
2023-12-31 09:09:48 +00:00
2022-10-13 20:53:56 -04:00
2023-10-16 23:35:05 +01:00
2023-12-31 09:09:48 +00:00
2022-10-13 20:53:56 -04:00
2023-10-16 23:34:24 +01:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2025-02-10 10:26:42 +01:00
2023-10-23 11:26:53 +01:00
2022-10-13 20:53:56 -04:00