Re: Proposal to speed up some compare functions



On 2001.11.06 15:31 Olaf Frączyk wrote:
> 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"

We do not want to access internal libmutt data directly from balsa (so, if 
the libmutt internals change, we will not have to rewrite half of balsa, 
list the libbalsa part).

What can be done is to uncomment  MESSAGE_COPY_CONTENT in 
libbalsa/message.h and recompile. I would be really interested to know if 
this changes the speed. This will copy subjects and numbers from libmutt 
structures to directly accessible libbalsa structures. Alternatively, one 
can copy number only, and use current method of accessing subjects.

/Pawel

> 
> 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
> _______________________________________________
> balsa-list mailing list
> balsa-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/balsa-list
-- 
Pawel Salek, Theoretical Chemistry, SCFAB, Stockholm
http://www.theochem.kth.se/~pawsa/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]