Revert "* bugfix for issue 164"
This reverts commitc7b28419ab. The reverted change fails to sort threads correctly when there is an empty container, serving as a parent to orphan messages, in the thread tree as demonstrated by the test in commitf49296759e("tests: threads: Test if orphan message promotes its thread"). Also, the reverted commit introduces a performance hit. The time it takes to sort threads has increased roughly by a factor of 4. Current state: $ perf stat --event=task-clock --repeat=10 -- \ mu find maildir:/INBOX -n 1 -t > /dev/null Performance counter stats for 'mu find maildir:/INBOX -n 1 -t' (10 runs): 4967.692519 task-clock (msec) # 1.000 CPUs utilized ( +- 0.14% ) 4.969247128 seconds time elapsed ( +- 0.14% ) With the reverted patch applied: $ perf stat --event=task-clock --repeat=10 -- \ mu find maildir:/INBOX -n 1 -t > /dev/null Performance counter stats for 'mu find maildir:/INBOX -n 1 -t' (10 runs): 1231.761588 task-clock (msec) # 0.996 CPUs utilized ( +- 1.02% ) 1.236209133 seconds time elapsed ( +- 1.08% ) The benchmark was ran on a maildir with ~16k messages: $ mu find maildir:/INBOX | wc -l 16503
This commit is contained in:
@ -317,22 +317,6 @@ struct _SortFuncData {
|
||||
};
|
||||
typedef struct _SortFuncData SortFuncData;
|
||||
|
||||
static MuContainer*
|
||||
get_top_msg (MuContainer *c, MuMsgFieldId mfid)
|
||||
{
|
||||
MuContainer *piv, *extreme = c;
|
||||
for (piv = c; piv != NULL && piv->msg != NULL; piv = piv->child) {
|
||||
if (mu_msg_cmp (piv->msg, extreme->msg, mfid) > 0)
|
||||
extreme = piv;
|
||||
if (piv != c && piv->next) {
|
||||
MuContainer *sub = get_top_msg (piv->next, mfid);
|
||||
|
||||
if (sub->msg != NULL && mu_msg_cmp (sub->msg, extreme->msg, mfid) > 0)
|
||||
extreme = sub;
|
||||
}
|
||||
}
|
||||
return extreme;
|
||||
}
|
||||
|
||||
static int
|
||||
sort_func_wrapper (MuContainer *a, MuContainer *b, SortFuncData *data)
|
||||
@ -344,9 +328,6 @@ sort_func_wrapper (MuContainer *a, MuContainer *b, SortFuncData *data)
|
||||
for (a1 = a; a1->msg == NULL && a1->child != NULL; a1 = a1->child);
|
||||
for (b1 = b; b1->msg == NULL && b1->child != NULL; b1 = b1->child);
|
||||
|
||||
a1 = get_top_msg (a1, data->mfid);
|
||||
b1 = get_top_msg (b1, data->mfid);
|
||||
|
||||
if (a1 == b1)
|
||||
return 0;
|
||||
else if (!a1->msg)
|
||||
|
||||
Reference in New Issue
Block a user