+ * Test object refcount performance
+ *************************************************************/
+
+#define NUM_KILO_REFS_PER_ROUND 100000
+
+struct RefcountTest {
+ GObject *object;
+ int n_checks;
+};
+
+static gpointer
+test_refcount_setup (PerformanceTest *test)
+{
+ struct RefcountTest *data;
+
+ data = g_new0 (struct RefcountTest, 1);
+ data->object = g_object_new (COMPLEX_TYPE_OBJECT, NULL);
+
+ return data;
+}
+
+static void
+test_refcount_init (PerformanceTest *test,
+ gpointer _data,
+ double factor)
+{
+ struct RefcountTest *data = _data;
+
+ data->n_checks = factor * NUM_KILO_REFS_PER_ROUND;
+}
+
+static void
+test_refcount_run (PerformanceTest *test,
+ gpointer _data)
+{
+ struct RefcountTest *data = _data;
+ GObject *object = data->object;
+ int i;
+
+ for (i = 0; i < data->n_checks; i++)
+ {
+ g_object_ref (object);
+ g_object_ref (object);
+ g_object_ref (object);
+ g_object_unref (object);
+ g_object_unref (object);
+
+ g_object_ref (object);
+ g_object_ref (object);
+ g_object_unref (object);
+ g_object_unref (object);
+ g_object_unref (object);
+ }
+}
+
+static void
+test_refcount_finish (PerformanceTest *test,
+ gpointer _data)
+{
+}
+
+static void
+test_refcount_print_result (PerformanceTest *test,
+ gpointer _data,
+ double time)
+{
+ struct RefcountTest *data = _data;
+ g_print ("Million refs+unref per second: %.2f\n",
+ data->n_checks * 5 / (time * 1000000 ));
+}
+
+static void
+test_refcount_teardown (PerformanceTest *test,
+ gpointer _data)
+{
+ struct RefcountTest *data = _data;
+
+ g_object_unref (data->object);
+ g_free (data);
+}
+
+/*************************************************************