Re: [Q] : Search performance



On 11.08.2002 17:35 Pawel Salek wrote:
> 
> On 2002.08.11 23:27 Emmanuel wrote:
>> 	Hi all,
>> I had a look at the balsa-index code : I saw that we now use a hash 
>> table to handle the search function. The problem I see with that is 
>> that we must test all messages whereas we're just looking for the next 
>> or previous one matching the condition. This is particularly suboptimal 
>> if you have a big mailbox and you're looking for a susbstring contained 
>> in the message body.
>> I think we should just test one by one.
> 
> I agree too. But, any method you are going to invent should be 
> consistent with the IMAP paradigm. I can imagine for example searching 
> IMAP mailboxes by in chunks of 100 messages, or something similar.
> 
> -pawel

We should construct hash table to do the search once and keep it as long 
as user change the conditions or new messages are added to the mailbox 
(messages deletion is not really a problem in that setting). This supposes 
that the scan struct is permanent and that we are connected on the mailbox 
signals.

Bonus : one-liner that corrects an access to a freed structure : 
--- /home/manu/prog/balsa-cvs/balsa/src/balsa-index.c   Sun Jul  7 
06:47:54 2002
+++ src/balsa-index.c   Mon Aug 12 05:25:33 2002
@@ -1005,8 +1005,8 @@
          /* if looking for new or flagged messages, fall back to first
           * matching */
          node = bi->first;
-    g_free(bi);
      if(bi->matching) g_hash_table_destroy(bi->matching);
+    g_free(bi);
      return node;
  }

Bye
Manu



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