gobject: Speed up property lookup

When the param specs are provided as an array
with g_object_class_install_properties, keep
a copy of that array around and use it for
looking up properties without the param spec
pool.

Note that this is an opportunistic optimization -
currently, it only works for properties of the
class itself, not for parent classes, and it
only works if the property names are identical
string literals (we're at the mercy of the linker
for that).

If we don't get lucky, we fall back to using
the pspec pool as usual.
This commit is contained in:
Matthias Clasen
2022-05-20 20:49:05 -04:00
parent d7c3b0fbf2
commit 47c12389a0
2 changed files with 135 additions and 46 deletions

View File

@@ -370,8 +370,12 @@ struct _GObjectClass
gsize flags;
gsize n_construct_properties;
gpointer pspecs;
gsize n_pspecs;
/* padding */
gpointer pdummy[5];
gpointer pdummy[3];
};
/**