From f0d8eaf83a2e8983b40ecb3b7ebe5832381348bf Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 26 Feb 2025 18:32:53 +0100 Subject: [PATCH] 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. --- gobject/tests/performance/performance.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/gobject/tests/performance/performance.c b/gobject/tests/performance/performance.c index 4b3c53668..e7c72245f 100644 --- a/gobject/tests/performance/performance.c +++ b/gobject/tests/performance/performance.c @@ -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,