Skip to content

gobject: cache flags needed for g_type_create_instance()

Every call to g_type_create_instance() currently will incur a RWLock at least once, but usually twice to test for both G_TYPE_FLAG_ABSTRACT and G_TYPE_FLAG_DEPRECATED.

Additionally, each call to g_type_instance_free() also checks for these. That results in a synchronization of GTypeInstance creation across all threads as well as being a huge amount of overhead when creating instances like GskRenderNode.

With this patch in place, the next two biggest issues are g_type_class_ref() and g_type_test_flags() not getting inlined within gtype.c in release builds. We can address that separately though.

Sysprof shows that the RWLock, with this patch in place, falls off the profiles.

Merge request reports

Loading