mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-26 14:06:15 +01:00
bfa8bef7b9
Make a number of improvements to g_object_new(): - instead of looking up the GParamSpec for the named property once in g_object_new() (in order to collect) and then again in g_object_newv (when actually setting the property), g_object_new_internal() is a new function that takes the GParamSpec on the interface to avoid the second lookup - in the case that ->constructor() is not set, we need not waste time creating an array of GObjectConstructParam to pass in. Just directly iterate the list of parameters, calling set_property() on each. - instead of playing with linked lists to keep track of the construct properties, realise that the number of construct properties that we will set is exactly equal to the length of the construct_properties list on GObjectClass and the only thing that may change is where the value comes from (in the case that it was passed in) This assumption was already implicit in the existing code and can be seen from the sizing of the array used to hold the construct properties, but it wasn't taken advantage of to make things simpler. - instead of allocating and filling a separate array of the non-construct properties just re-iterate the passed-in list and set all properties that were not marked G_PARAM_CONSTRUCT (since the ones that were construct params were already used during construction) - use the new g_param_spec_get_default_value() API instead of allocating and setting the GValue for each construct property that wasn't passed from the user Because we are now iterating the linked list of properties in-order we need to append to that list during class initialising instead of prepending. These changes show a very small improvement on the simple-construction performance testcase (probably just noise) and they improve the complex-construction case by ~30%. Thanks to Alex Larsson for reviews and fixes. https://bugzilla.gnome.org/show_bug.cgi?id=698056 |
||
---|---|---|
.. | ||
tests | ||
.gitignore | ||
ChangeLog | ||
gatomicarray.c | ||
gatomicarray.h | ||
gbinding.c | ||
gbinding.h | ||
gboxed.c | ||
gboxed.h | ||
gclosure.c | ||
gclosure.h | ||
genums.c | ||
genums.h | ||
glib-genmarshal.c | ||
glib-mkenums.in | ||
glib-types.h | ||
gmarshal.c | ||
gmarshal.h | ||
gmarshal.list | ||
gobject_probes.d | ||
gobject_trace.h | ||
gobject-query.c | ||
gobject.c | ||
gobject.h | ||
gobject.py | ||
gobject.rc.in | ||
gobject.stp.in | ||
gobjectnotifyqueue.c | ||
gparam.c | ||
gparam.h | ||
gparamspecs.c | ||
gparamspecs.h | ||
gsignal.c | ||
gsignal.h | ||
gsourceclosure.c | ||
gsourceclosure.h | ||
gtype-private.h | ||
gtype.c | ||
gtype.h | ||
gtypemodule.c | ||
gtypemodule.h | ||
gtypeplugin.c | ||
gtypeplugin.h | ||
gvalue.c | ||
gvalue.h | ||
gvaluearray.c | ||
gvaluearray.h | ||
gvaluecollector.h | ||
gvaluetransform.c | ||
gvaluetypes.c | ||
gvaluetypes.h | ||
libgobject-gdb.py.in | ||
Makefile.am | ||
makefile.msc.in | ||
marshal-genstrings.pl |