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 712091F6AE 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=K7oafFkwMU4ttmUwHJep2xx1SyZK3ccxO+krh8CPfWE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=sWoh4cqX74hAzQNiP47ELAJVlfUAyHQdn4yXxyRN149fhahV43exR8SBsDDOonz2u k9yijDc2qTwwDzc2nYzbIc6JZoKoK1X2Ed7k6FBq35agxt6+OCuxwRcRQQurjrU7Fa Q4qU+33bkdanAHvvj2cWPbcEZM30jYCpxXaj/6S4= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 37/38] www_listing: switch to `print $zfh' Date: Sat, 10 Sep 2022 08:17:28 +0000 Message-Id: <20220910081729.2011934-38-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, ->deflate (and thus ->zmore) calls are relatively expensive compared to `print' ops using PerlIO::scalar behind-the-scenes. While I can likely optimize the `join' away here, too, that will happen in a future commit. --- lib/PublicInbox/WwwListing.pm | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/lib/PublicInbox/WwwListing.pm b/lib/PublicInbox/WwwListing.pm index 35abf050..72c940dd 100644 --- a/lib/PublicInbox/WwwListing.pm +++ b/lib/PublicInbox/WwwListing.pm @@ -208,27 +208,28 @@ sub psgi_triple { my $h = [ 'Content-Type', 'text/html; charset=UTF-8', 'Content-Length', undef ]; my $gzf = gzf_maybe($h, $ctx->{env}); - $gzf->zmore('public-inbox listing' . - $ctx->{www}->style('+/') . - ''); + my $zfh = $gzf->zfh; + print $zfh 'public-inbox listing', + $ctx->{www}->style('+/'), + ''; my $code = 404; if (my $list = delete $ctx->{-list}) { my $mset = delete $ctx->{-mset}; $code = 200; if ($mset) { # already sorted, so search bar: - $gzf->zmore(mset_nav_top($ctx, $mset)); + print $zfh mset_nav_top($ctx, $mset); } else { # sort config dump by ->modified @$list = map { $_->[1] } sort { $b->[0] <=> $a->[0] } @$list; } - $gzf->zmore('
', join("\n", @$list)); # big
-		$gzf->zmore(mset_footer($ctx, $mset)) if $mset;
+		print $zfh '
', join("\n", @$list); # big
+		print $zfh mset_footer($ctx, $mset) if $mset;
 	} elsif (my $mset = delete $ctx->{-mset}) {
-		$gzf->zmore(mset_nav_top($ctx, $mset) .
-				'
no matching inboxes' .
-				mset_footer($ctx, $mset));
+		print $zfh mset_nav_top($ctx, $mset),
+				'
no matching inboxes',
+				mset_footer($ctx, $mset);
 	} else {
-		$gzf->zmore('
no inboxes, yet');
+		print $zfh '
no inboxes, yet';
 	}
 	my $out = $gzf->zflush('

'.
 qq(This is a listing of public inboxes, see the `mirror' link of each inbox