about summary refs log tree commit homepage
path: root/t/thread-cycle.t
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-04-17 09:28:49 +0000
committerEric Wong <e@yhbt.net>2020-04-17 09:52:26 +0000
commitd0147582e289fdd4cdd84e91d8b0f8ae9c230124 (patch)
tree02d60802e4eef79bbbe7f9ca4a2210f2d3a07f28 /t/thread-cycle.t
parentc23c96b1da7bfff3efe64ad415c0feb424d34559 (diff)
downloadpublic-inbox-d0147582e289fdd4cdd84e91d8b0f8ae9c230124.tar.gz
We can rid ourselves of a layer of indirection by subclassing
PublicInbox::Smsg instead of using a container object to hold
each $smsg.  Furthermore, the `{id}' vs. `{mid}' field name
confusion is eliminated.

This reduces the size of the $rootset passed to walk_thread by
around 15%, that is over 50K memory when rendering a /$INBOX/
landing page.
Diffstat (limited to 't/thread-cycle.t')
-rw-r--r--t/thread-cycle.t5
1 files changed, 3 insertions, 2 deletions
diff --git a/t/thread-cycle.t b/t/thread-cycle.t
index e9ea0a27..d6545c6d 100644
--- a/t/thread-cycle.t
+++ b/t/thread-cycle.t
@@ -19,6 +19,7 @@ sub make_objs {
                 my $msg = $_;
                 $msg->{ds} ||= ++$n;
                 $msg->{references} =~ s/\s+/ /sg if $msg->{references};
+                $msg->{blob} = '0'x40; # any dummy value will do, here
                 my $simple = Email::Simple->create(header => [
                         'Message-ID' => "<$msg->{mid}>",
                         'References' => $msg->{references},
@@ -100,13 +101,13 @@ done_testing();
 sub thread_to_s {
         my ($msgs) = @_;
         my $rootset = PublicInbox::SearchThread::thread($msgs, sub {
-                [ sort { $a->{id} cmp $b->{id} } @{$_[0]} ] });
+                [ sort { $a->{mid} cmp $b->{mid} } @{$_[0]} ] });
         my $st = '';
         my @q = map { (0, $_) } @$rootset;
         while (@q) {
                 my $level = shift @q;
                 my $node = shift @q or next;
-                $st .= (" "x$level). "$node->{id}\n";
+                $st .= (" "x$level). "$node->{mid}\n";
                 my $cl = $level + 1;
                 unshift @q, map { ($cl, $_) } @{$node->{children}};
         }