NetworkManager/libnm-core/tests
Thomas Haller 3f36f69156 libnm: refactor NMSettInfoProperty to save memory for simple properties
In total, we register 447 property informations. Out of these,
326 are plain, GObject property based without special implementations.

The NMSettInfoProperty had all function pointers directly embedded,
currently this amounts to 5 function pointers and the "dbus_type" field.

That means, at runtime we have 326 times trivial implementations with
waste 326*6*8 bytes of NULL pointers. We can compact these by moving
them to a separate structure.

Before:

    447 * 5 function pointers
    447 * "dbus_type" pointer
    = 2682 pointers

After:

    447 * 1 pointers (for NMSettInfoProperty.property_type)
     89 * 6 pointers (for the distinct NMSettInfoPropertType data)
    = 981 pointers

So, in total this saves 13608 byes of runtime memory (on 64 bit arch).

The 89 NMSettInfoPropertType instances are the remaining distinct instances.
Note that every NMSettInfoProperty has a "property_type" pointer, but most of them are
shared. That is because the underlying type and the operations are the same.

Also nice is that the NMSettInfoPropertType are actually constant,
static fields and initialized very early.

This change also makes sense form a design point of view. Previously,
NMSettInfoProperty contained both per-property data (the "name") but
also the behavior. Now, the "behavioral" part is moved to a separate
structure (where it is also shared). That means, the parts that are
concerned with the type of the property (the behavior) are separate
from the actual data of the property.
2019-09-30 08:23:19 +02:00
..
certs libnm/crypto: accept TPM2-wrapped PEM keys 2019-07-10 17:31:48 +02:00
meson.build build/meson: rename "nm_core_dep" to "libnm_core_dep" 2019-04-18 20:13:49 +02:00
nm-core-tests-enum-types.c.template build: use template files for enum types' sources generation 2017-12-18 11:25:06 +01:00
nm-core-tests-enum-types.h.template build: use template files for enum types' sources generation 2017-12-18 11:25:06 +01:00
test-compare.c all: SPDX header conversion 2019-09-10 11:19:56 +02:00
test-crypto.c all: SPDX header conversion 2019-09-10 11:19:56 +02:00
test-general-enums.h all: SPDX header conversion 2019-09-10 11:19:56 +02:00
test-general.c setting-gsm: allow empty apn property in verify() 2019-09-11 14:32:05 +02:00
test-keyfile.c all: SPDX header conversion 2019-09-10 11:19:56 +02:00
test-secrets.c all: SPDX header conversion 2019-09-10 11:19:56 +02:00
test-setting.c libnm: refactor NMSettInfoProperty to save memory for simple properties 2019-09-30 08:23:19 +02:00
test-settings-defaults.c all: SPDX header conversion 2019-09-10 11:19:56 +02:00