diff options
author | Eric Wong <e@80x24.org> | 2022-09-10 08:17:16 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2022-09-10 19:50:46 +0000 |
commit | dc5314822113431d90dd0c65d3a1a22ea31f7c3b (patch) | |
tree | b92df03fa06366635d93876ed6a3a128d0218ed6 /lib/PublicInbox/View.pm | |
parent | 03673adef5a74f7ebd6be960187e5e8592779900 (diff) | |
download | public-inbox-dc5314822113431d90dd0c65d3a1a22ea31f7c3b.tar.gz |
view: switch a few things to ctx->zmore
Unfortunately, this is actually slower. However, this hopefully makes it easier to improve the internals and make performance improvements down the line.
Diffstat (limited to 'lib/PublicInbox/View.pm')
-rw-r--r-- | lib/PublicInbox/View.pm | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm index 2f99179e..3dbf8bac 100644 --- a/lib/PublicInbox/View.pm +++ b/lib/PublicInbox/View.pm @@ -560,7 +560,7 @@ sub add_text_body { # callback for each_part my ($part, $depth, $idx) = @$p; my $ct = $part->content_type || 'text/plain'; my $fn = $part->filename; - my $rv = $ctx->{obuf}; + my $rv = $ctx->{obuf} //= \(my $obuf = ''); my ($s, $err) = msg_part_text($part, $ct); $s // return $$rv .= (attach_link($ctx, $ct, $p, $fn) // ''); if ($part->{is_submsg}) { @@ -618,18 +618,16 @@ sub add_text_body { # callback for each_part $$rv .= "\n"; } delete $part->{bdy}; # save memory - foreach my $cur (@sections) { + for my $cur (@sections) { # $cur may be huge if ($cur =~ /\A>/) { # we use a <span> here to allow users to specify # their own color for quoted text - $$rv .= qq(<span\nclass="q">); - $$rv .= $l->to_html($cur); - $$rv .= '</span>'; + $ctx->zmore(qq(<span\nclass="q">), + $l->to_html($cur), '</span>'); } elsif ($diff) { flush_diff($ctx, \$cur); - } else { - # regular lines, OK - $$rv .= $l->to_html($cur); + } else { # regular lines, OK + $ctx->zmore($l->to_html($cur)); } undef $cur; # free memory } |