From f14de4784bbc5030ed20dfc78c0a8f2f6aa16241 Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Fri, 3 Jun 2011 08:22:56 +0300 Subject: [PATCH] * mu-msg-iter.cc: pre-fetch documents in an mset, makes search slightly faster --- src/mu-msg-iter.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/mu-msg-iter.cc b/src/mu-msg-iter.cc index a60d31ad..c036eef9 100644 --- a/src/mu-msg-iter.cc +++ b/src/mu-msg-iter.cc @@ -28,6 +28,10 @@ #include "mu-msg.h" #include "mu-msg-iter.h" +/* just a guess... */ +#define MAX_FETCH_SIZE 10000 + + static gboolean update_msg (MuMsgIter *iter); struct _MuMsgIter { @@ -36,6 +40,11 @@ struct _MuMsgIter { _matches = _enq.get_mset (0, maxnum); _cursor = _matches.begin(); + + /* this seems to make search slightly faster, some + * non-scientific testing suggests. 5-10% or so */ + if (_matches.size() <= MAX_FETCH_SIZE) + _matches.fetch (); if (!_matches.empty()) update_msg (this);