gobject/performance: add "property-set-signaled" test

g_object_set() optimizes the case where there are no signals connected.
Add a test that sets the property with signals. Obviously, this one is
much slower, since we will freeze and thaw the notifications.
This commit is contained in:
Thomas Haller
2025-02-26 18:32:53 +01:00
parent 6610be0ef9
commit f0d8eaf83a

View File

@@ -1146,6 +1146,14 @@ test_set_setup (PerformanceTest *test)
* "property-get" test and avoid this by taking an additional reference. */
g_object_ref (data->object);
if (g_str_equal (test->name, "property-set-signaled"))
{
/* If an object has a listener, then a property set will freeze notifications.
* That has an overhead, and we have a separate test for that. */
g_signal_connect (data->object, "notify::val2",
G_CALLBACK (test_notify_handled_handler), NULL);
}
return data;
}
@@ -1622,6 +1630,17 @@ static PerformanceTest tests[] = {
test_set_teardown,
test_set_print_result
},
{
"property-set-signaled",
complex_object_get_type,
45019,
test_set_setup,
test_set_init,
test_set_run,
test_set_finish,
test_set_teardown,
test_set_print_result
},
{
"property-get",
complex_object_get_type,