gobject n_preallocs
- From: tom <tom dbservice com>
- To: gtk-devel-list gnome org
- Subject: gobject n_preallocs
- Date: Tue, 14 Jan 2003 22:02:46 +0100
i tried to set n_preallocs to 0, 100, 1000, etc, but it takes always the
same time to create objects...
here's an example:
#define NUM 10000
object[0] = (gpointer) dobject_new ();
g_object_set (object[0], "visible", TRUE, NULL); //optional
g_object_set (object[0], "name", "foobar", NULL); //optional
g_timer_elapsed (timer, &ms);
g_print ("creating: %i\n", ms);
g_timer_reset (timer);
for (i = 1; i < NUM; i++)
{
object[i] = (gpointer) dobject_new ();
g_object_set (object[i], "visible", TRUE, NULL); //optional
g_object_set (object[i], "name", "foobar", NULL); //optional
}
g_timer_elapsed (timer, &ms);
g_print ("creating: %i\n", ms);
g_timer_reset (timer);
for (i = 0; i < NUM; i++)
{
g_type_free_instance (object[i]);
}
g_timer_elapsed (timer, &ms);
g_print ("freed: %i\n", ms);
and i get:
1) set n_preallocs to 5000:
creating: 1150
creating: 521214
freed: 5034
1) set n_preallocs to 0:
creating: 1146
creating: 518206
freed: 5536
whats wrong?
tom
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]