about summary refs log tree commit homepage
path: root/lib/PublicInbox/View.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2022-09-10 08:17:03 +0000
committerEric Wong <e@80x24.org>2022-09-10 19:50:33 +0000
commit7946a7fce008989458a28641cc899c8bbd99c2c4 (patch)
tree92b3787ee1b377cbcd6491f8330a3b733be12296 /lib/PublicInbox/View.pm
parent404fb35c07290ac4f5f618bac6626573c79ddc50 (diff)
downloadpublic-inbox-7946a7fce008989458a28641cc899c8bbd99c2c4.tar.gz
view: eml_entry: reduce manipulation of ctx->{obuf}
This is another step towards avoid unnecessary copies
and pad space waste.
Diffstat (limited to 'lib/PublicInbox/View.pm')
-rw-r--r--lib/PublicInbox/View.pm9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index 3980ed91..37b484ae 100644
--- a/lib/PublicInbox/View.pm
+++ b/lib/PublicInbox/View.pm
@@ -246,11 +246,11 @@ sub eml_entry {
         $ctx->{mhref} = $mhref;
         $ctx->{changed_href} = "#e$id"; # for diffstat "files? changed,"
         $ctx->{obuf} = \$rv;
-        $eml->each_part(\&add_text_body, $ctx, 1);
-        delete $ctx->{obuf};
+        $eml->each_part(\&add_text_body, $ctx, 1); # expensive
+        $ctx->zmore; # TODO: remove once add_text_body is updated
 
         # add the footer
-        $rv .= "\n<a\nhref=#$id_m\nid=e$id>^</a> ".
+        $rv = "\n<a\nhref=#$id_m\nid=e$id>^</a> ".
                 "<a\nhref=\"$mhref\">permalink</a>" .
                 " <a\nhref=\"${mhref}raw\">raw</a>" .
                 " <a\nhref=\"${mhref}#R\">reply</a>";
@@ -388,7 +388,8 @@ sub pre_thread  { # walk_thread callback
 sub thread_eml_entry {
         my ($ctx, $eml) = @_;
         my ($beg, $end) = thread_adj_level($ctx, $ctx->{level});
-        $beg . '<pre>' . eml_entry($ctx, $eml) . '</pre>' . $end;
+        $ctx->zmore($beg.'<pre>');
+        eml_entry($ctx, $eml) . '</pre>' . $end;
 }
 
 sub next_in_queue ($$) {