about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2022-09-10 08:17:29 +0000
committerEric Wong <e@80x24.org>2022-09-10 19:50:57 +0000
commit12900fecdc4c7f577eb8266a2334d74f72fd2518 (patch)
treede6a93d405cf70abd54c96be731d1fc5a9c853ba
parent4981c5c7940ca0a7b669fd4c5b8338bdd6cee710 (diff)
downloadpublic-inbox-12900fecdc4c7f577eb8266a2334d74f72fd2518.tar.gz
Again, ->zmore has proven expensive due to the overhead of
calling ->deflate on small strings, so print directly to the
file handle and let the PerlIO::scalar layer take care of
buffering.  One of the ->zmore calls was a no-op, even, so
drop that entirely.
-rw-r--r--lib/PublicInbox/ViewVCS.pm11
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/PublicInbox/ViewVCS.pm b/lib/PublicInbox/ViewVCS.pm
index 57ab378d..f740591d 100644
--- a/lib/PublicInbox/ViewVCS.pm
+++ b/lib/PublicInbox/ViewVCS.pm
@@ -189,7 +189,8 @@ href="$f.patch">patch</a>)\n   <a href=#parent>parent</a> $P->[0]};
                 $x = ' (<a href=#root_commit>root commit</a>)';
         }
         PublicInbox::WwwStream::html_init($ctx);
-        $ctx->zmore(<<EOM);
+        my $zfh = $ctx->zfh;
+        print $zfh <<EOM;
 <pre>   <a href=#commit>commit</a> $H$x
      <a href=#tree>tree</a> <a href="$upfx$T/s/">$T</a>
    author $au
@@ -197,16 +198,14 @@ committer $co
 
 <b>$s</b>
 EOM
-        $ctx->zmore("\n", $ctx->{-linkify}->to_html($bdy)) if length($bdy);
+        print $zfh "\n", $ctx->{-linkify}->to_html($bdy) if length($bdy);
         $bdy = '';
         open my $fh, '<:utf8', "$ctx->{-tmp}/p" or
                 die "open $ctx->{-tmp}/p: $!";
         if (-s $fh > $MAX_SIZE) {
-                $ctx->zmore("---\n patch is too large to show\n");
+                print $zfh "---\n patch is too large to show\n";
         } else { # prepare flush_diff:
                 read($fh, $x, -s _);
-                $ctx->zmore($bdy);
-                undef $bdy;
                 $ctx->{-apfx} = $ctx->{-spfx} = $upfx;
                 $x =~ s/\r?\n/\n/gs;
                 $ctx->{-anchors} = {} if $x =~ /^diff --git /sm;
@@ -228,7 +227,7 @@ EOM
                         $q = wrap('', '', $q);
                         my $rows = ($q =~ tr/\n/\n/) + 1;
                         $q = ascii_html($q);
-                        $ctx->zmore(<<EOM);
+                        print $zfh <<EOM;
 <hr><form action=$upfx
 id=related><pre>find related emails, including ancestors/descendants/conflicts
 <textarea name=q cols=${\PublicInbox::View::COLS} rows=$rows>$q</textarea>