Commit Graph

20 Commits

Author SHA1 Message Date
Marcelo Henrique Cerri 297120dc6c lib: add last_child flag to thread information
With that flag it's possible to reconstruct the entire thread tree
structure in mu4e.
2018-04-23 01:05:54 -03:00
Jakub Sitnicki c9cb27be11 mu: Make mu_container_splice_grandchildren() do only one thing
Don't kill the resultant childless container when promoting its
children. This unifies the behavior of mu_container_splice_*()
functions.
2014-08-15 10:11:21 +02:00
Jakub Sitnicki bb0cc542b8 mu: Prune empty containers from the root set after splicing their children
When the root set contains only one empty container with one child
first promote the child container to the root set and only then
remove the empty parent container so that the root set never goes
empty.

Also make mu_container_splice_children() do only one thing, that is
promote one container's children to be another container's siblings.
The resultant childless container is no longer removed by this
function.

Fixes #460.
2014-08-15 10:10:39 +02:00
Jakub Sitnicki 32f5c8b1f6 mu: Sort containers by comparing their subtree leaders
Traverse the container tree depth first and for each container find
the node in the subtree rooted at this container which comes first in
the descending sort order. Remember it as the subtree leader. Then,
while sorting siblings, compare their subtree leaders instead of the
sibling containers themselves.

IOW, make threads containing the newest message float to the top when
sorting by date in the descending order.

There is no significant performance degradation when sorting a
mailbox with ~16k messages:

$ mu find maildir:/INBOX | wc -l
16503

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):

       1231.761588      task-clock (msec)         #    0.996 CPUs utilized            ( +-  1.02% )

       1.236209133 seconds time elapsed                                          ( +-  1.08% )

With 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):

       1459.883316      task-clock (msec)         #    0.998 CPUs utilized            ( +-  0.72% )

       1.462540088 seconds time elapsed                                          ( +-  0.77% )

This implements https://github.com/djcb/mu/issues/164.
2014-07-15 07:25:51 +02:00
Jakub Sitnicki 619fb86885 mu: Update container's pointer to last sibling when converting from a list 2014-07-15 07:25:51 +02:00
Jakub Sitnicki 97101f1f82 mu: Prune empty container when an only child gets promoted to the root set 2014-07-15 07:25:51 +02:00
Jakub Sitnicki f724f4a57d mu: Consider an empty container to be less than anything else
Reasoning being that, arguably, it is the least surprising thing to do.
2014-07-15 07:25:50 +02:00
Jakub Sitnicki dc3be515af mu: Extract function for comparing two containers 2014-07-15 07:25:50 +02:00
Jakub Sitnicki d93b8135a6 Revert "* bugfix for issue 164"
This reverts commit c7b28419ab.

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 commit f49296759e ("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
2014-07-15 07:24:56 +02:00
omfgroflbbq c7b28419ab * bugfix for issue 164 2014-03-20 16:22:50 +01:00
djcb fa514435ea * merge branch 'master' of github.com:djcb/mu 2013-06-13 23:56:35 +03:00
djcb 855e81db99 * update copyright years 2013-03-30 11:32:07 +02:00
djcb c5f8ea6451 * use AM_CPPFLAGS instead of INCLUDES 2012-12-22 22:54:50 +02:00
djcb 2f9dd78bb0 * add query flags (which match msgiterflags) to mu_query_run, update callers 2012-12-16 15:08:34 +02:00
djcb cbbb23c13f * Fixes for the threading algorithm (thanks to Abdó Roig)
The problem was that once a container got a parent, it did not change it anymore
  due to the child_elligible condition, but the parent might have been assigned
  from an incomplete References sequence.

  Now, we make sure the last reference gets to be the message's parent (following
  the JWZ's algorithm), reparenting the message if necessary. This makes sense, as
  the last parent-child relationship (between last ref and the message) is the
  most reliable piece of info here.

  Instead of child_elligible, we now only check that the new parent is not a
  descendant of the current message, to prevent making a loop. Everything else is
  fine, as it only moves a subtree around.
2012-12-09 13:48:22 +02:00
djcb 8ad01e4aa8 * lib: threading: pre-sort the threaded results, add some more comments 2012-10-17 17:59:33 +03:00
djcb 28136a4e04 * cosmetics 2012-09-19 16:56:25 +03:00
djcb e483291a1d * lib/mu-container: remove some O(n*n) behavior from threading
mu_container_append_siblings was showing up high in profiles as it has to
  walk chains of next->next->next->... pointers to find the last one. we now
  cache the last link in the chain. for listing ~ 23K messages, this saves
  about 20%.
2012-09-17 17:45:59 +03:00
djcb 6bff28a6ff * cosmetics 2012-09-16 13:16:01 +03:00
djcb 46f10cfde9 * refactoring: split src/ into mu/ and lib/ 2012-05-21 09:25:53 +03:00