From 12900fecdc4c7f577eb8266a2334d74f72fd2518 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 10 Sep 2022 08:17:29 +0000 Subject: [PATCH] viewvcs: switch to `print $zfh' 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. --- lib/PublicInbox/ViewVCS.pm | 11 +++++------ 1 file 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)\n parent $P->[0]}; $x = ' (root commit)'; } PublicInbox::WwwStream::html_init($ctx); - $ctx->zmore(<zfh; + print $zfh < commit $H$x tree $T author $au @@ -197,16 +198,14 @@ committer $co $s 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(<