#include const gchar *vcard = "BEGIN:VCARD\n" "VERSION:3.0\n" "CLASS:PUBLIC\n" "REV:2011-03-14T13:47:25Z\n" "FN:First %d Last %d\n" "N:Last %d;First %d;;;\n" "EMAIL;WORK:rhome0 example com%d\n" "TEL;TYPE=cell,voice:02141730585%d\n" "NOTE;ENCODING=QUOTED-PRINTABLE:c1f1b12d-bc75-4d45-9a1f-b1efe934409f\n" "END:VCARD\n"; static EContact * new_test_contact (guint i) { EContact *contact; gchar *str = g_strdup_printf (vcard, i,i,i,i,i,i); contact = e_contact_new_from_vcard (str); g_free (str); return contact; } EBook *book; int main () { GError *error = NULL; guint i, y = 1000; GTimer *timer; g_type_init (); timer = g_timer_new (); book = e_book_new_default_addressbook (&error); if (error) { g_critical ("%s\n", error->message); return 0; } e_book_open (book, FALSE, &error); if (error) { g_critical ("%s\n", error->message); return 0; } g_timer_start (timer); for (i = 0; i < y; i++) { EContact *contact = new_test_contact (i); e_book_add_contact (book, contact, &error); if (error) { g_critical ("%s\n", error->message); g_object_unref (contact); return 0; } e_book_commit_contact (book, contact, &error); if (error) { g_critical ("%s\n", error->message); g_object_unref (contact); return 0; } g_object_unref (contact); } g_timer_stop (timer); g_print ("EDS %d contacts: %f\n", y, g_timer_elapsed (timer, NULL)); g_object_unref (book); }