* mu-msg-iter.cc: pre-fetch documents in an mset, makes search slightly faster
This commit is contained in:
@ -28,6 +28,10 @@
|
|||||||
#include "mu-msg.h"
|
#include "mu-msg.h"
|
||||||
#include "mu-msg-iter.h"
|
#include "mu-msg-iter.h"
|
||||||
|
|
||||||
|
/* just a guess... */
|
||||||
|
#define MAX_FETCH_SIZE 10000
|
||||||
|
|
||||||
|
|
||||||
static gboolean update_msg (MuMsgIter *iter);
|
static gboolean update_msg (MuMsgIter *iter);
|
||||||
|
|
||||||
struct _MuMsgIter {
|
struct _MuMsgIter {
|
||||||
@ -37,6 +41,11 @@ struct _MuMsgIter {
|
|||||||
_matches = _enq.get_mset (0, maxnum);
|
_matches = _enq.get_mset (0, maxnum);
|
||||||
_cursor = _matches.begin();
|
_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())
|
if (!_matches.empty())
|
||||||
update_msg (this);
|
update_msg (this);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user