Proposal to speed up some compare functions
- From: Olaf Frączyk <olaf cbk poznan pl>
- To: balsa-list gnome org
- Subject: Proposal to speed up some compare functions
- Date: Tue, 6 Nov 2001 15:31:09 +0100
Hi,
I found that in e.g. numeric_compare we use:
t1 = LIBBALSA_MESSAGE_GET_NO(m1);
this is a macro, but the macro resolves ... to function. So we waste time
to make another function call.
I changed the function to:
static gint
numeric_compare(GtkCList * clist, gconstpointer ptr1, gconstpointer ptr2)
{
if(!((GtkCListRow*)ptr1)->data || !((GtkCListRow*)ptr2)->data)
return 0;
return(((LibBalsaMessage*)((GtkCListRow*)ptr2)->data)->header->msgno
-((LibBalsaMessage*)((GtkCListRow*)ptr1)->data)->header->msgno);
}
And to make it working you have to add include:
#include "mailbackend.h"
I have compared times for the same mailbox as in my previous mail.
Sorting with original function takes 19-19.5 seconds.
Sorting with the new one takes about 14.5 seconds.
In other places I found similiar constructions.
Regards,
Olaf
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]