[glib/gobject-performance: 12/12] Test more interfaces
- From: Alexander Larsson <alexl src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [glib/gobject-performance: 12/12] Test more interfaces
- Date: Wed, 9 Sep 2009 15:20:50 +0000 (UTC)
commit ea05159610aa26d5683b5f625a0c798ce3605790
Author: Alexander Larsson <alexl redhat com>
Date: Wed Sep 9 17:06:01 2009 +0200
Test more interfaces
tests/gobject/performance.c | 43 ++++++++++++++++++++++++++++++++++++-------
1 files changed, 36 insertions(+), 7 deletions(-)
---
diff --git a/tests/gobject/performance.c b/tests/gobject/performance.c
index 1dc982b..fbed66e 100644
--- a/tests/gobject/performance.c
+++ b/tests/gobject/performance.c
@@ -190,8 +190,13 @@ simple_object_init (SimpleObject *simple_object)
simple_object->val = 42;
}
-typedef struct _TestIface TestIface;
typedef struct _TestIfaceClass TestIfaceClass;
+typedef struct _TestIfaceClass TestIface1Class;
+typedef struct _TestIfaceClass TestIface2Class;
+typedef struct _TestIfaceClass TestIface3Class;
+typedef struct _TestIfaceClass TestIface4Class;
+typedef struct _TestIfaceClass TestIface5Class;
+typedef struct _TestIface TestIface;
struct _TestIfaceClass
{
@@ -199,8 +204,17 @@ struct _TestIfaceClass
void (*method) (TestIface *obj);
};
-#define TEST_TYPE_IFACE (test_iface_get_type ())
-static DEFINE_IFACE (TestIface, test_iface, NULL, NULL)
+#define TEST_TYPE_IFACE1 (test_iface1_get_type ())
+#define TEST_TYPE_IFACE2 (test_iface2_get_type ())
+#define TEST_TYPE_IFACE3 (test_iface3_get_type ())
+#define TEST_TYPE_IFACE4 (test_iface4_get_type ())
+#define TEST_TYPE_IFACE5 (test_iface5_get_type ())
+
+static DEFINE_IFACE (TestIface1, test_iface1, NULL, NULL)
+static DEFINE_IFACE (TestIface2, test_iface2, NULL, NULL)
+static DEFINE_IFACE (TestIface3, test_iface3, NULL, NULL)
+static DEFINE_IFACE (TestIface4, test_iface4, NULL, NULL)
+static DEFINE_IFACE (TestIface5, test_iface5, NULL, NULL)
/*************************************************************
* Complex object is a GObject subclass with a properties,
@@ -230,8 +244,17 @@ static void complex_test_iface_init (gpointer g_iface,
G_DEFINE_TYPE_EXTENDED (ComplexObject, complex_object,
G_TYPE_OBJECT, 0,
- G_IMPLEMENT_INTERFACE (TEST_TYPE_IFACE,
- complex_test_iface_init));
+ G_IMPLEMENT_INTERFACE (TEST_TYPE_IFACE1,
+ complex_test_iface_init)
+ G_IMPLEMENT_INTERFACE (TEST_TYPE_IFACE2,
+ complex_test_iface_init)
+ G_IMPLEMENT_INTERFACE (TEST_TYPE_IFACE3,
+ complex_test_iface_init)
+ G_IMPLEMENT_INTERFACE (TEST_TYPE_IFACE4,
+ complex_test_iface_init)
+ G_IMPLEMENT_INTERFACE (TEST_TYPE_IFACE5,
+ complex_test_iface_init)
+ );
#define COMPLEX_OBJECT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), COMPLEX_TYPE_OBJECT, ComplexObject))
@@ -493,12 +516,18 @@ test_type_check_run (PerformanceTest *test,
{
struct TypeCheckTest *data = _data;
volatile GObject *object = data->object;
- volatile GType type;
+ volatile GType type, types[5];
int i, j;
- type = test_iface_get_type ();
+ types[0] = test_iface1_get_type ();
+ types[1] = test_iface2_get_type ();
+ types[2] = test_iface3_get_type ();
+ types[3] = test_iface4_get_type ();
+ types[4] = test_iface5_get_type ();
+
for (i = 0; i < data->n_checks; i++)
{
+ type = types[i%5];
for (j = 0; j < 1000; j++)
{
my_type_check_instance_is_a ((GTypeInstance *)object,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]