From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, T_SCC_BODY_TEXT_LINE shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id A20B61F6AF for ; Sat, 10 Sep 2022 08:18:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1662797938; bh=jPa/5RrapEaX0BNGeOPq7eCxKukbZodg3Dg6tBdXH64=; h=From:To:Subject:Date:In-Reply-To:References:From; b=PcXShlIC1AlzIC/CTioR5lViwtXxjh6jpbpJJgCROx2OZjrxhOBgdtUgXfpvKB8v3 VGtl3RPy2cguLuRtSwob64vBY9tuf3CcyaDEyAQj7CEtNMmkVeC/aU549NY4R2tHAT iIeTboUAIkP0/cFK94KklD2WFCQkLB4N2alXXqo8= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 38/38] viewvcs: switch to `print $zfh' Date: Sat, 10 Sep 2022 08:17:29 +0000 Message-Id: <20220910081729.2011934-39-e@80x24.org> In-Reply-To: <20220910081729.2011934-1-e@80x24.org> References: <20220910081729.2011934-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: 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(<