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 56F2D1F601 for ; Sat, 20 Aug 2022 08:01:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1660982496; bh=nKPtXu/2BXxPf0hsVG00K43ttvS4k2J0xIlrJDn6AB8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=nPavLuOUVBXO4JCoZzil0zBCd58mtClMNRDTEFHNv6yC06xWnhLflqJoj7hBr/UaQ iYfaf/IN0dijEQ5uKISLWk71SD3kHScBTMKz43aAyJSMTgf6jgyW8CuJRuEs6oMPDP YOplxw3/0yWYvX4CVpFnWDsOZwx2Wx/LyeSxAeMw= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 2/5] imap: remove some intermediate arrays Date: Sat, 20 Aug 2022 08:01:32 +0000 Message-Id: <20220820080135.58439-3-e@80x24.org> In-Reply-To: <20220820080135.58439-1-e@80x24.org> References: <20220820080135.58439-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: We can assign arrays directly without `[]' creating an extra immortal pad allocation. --- lib/PublicInbox/IMAP.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/PublicInbox/IMAP.pm b/lib/PublicInbox/IMAP.pm index 0a65d87c..1f65aa65 100644 --- a/lib/PublicInbox/IMAP.pm +++ b/lib/PublicInbox/IMAP.pm @@ -1005,7 +1005,7 @@ sub fetch_compile ($) { # stabilize partial order for consistency and ease-of-debugging: if (scalar keys %partial) { $need |= NEED_BLOB; - $r[2] = [ map { [ $_, @{$partial{$_}} ] } sort keys %partial ]; + @{$r[2]} = map { [ $_, @{$partial{$_}} ] } sort keys %partial; } push @op, $OP_EML_NEW if ($need & (EML_HDR|EML_BDY)); @@ -1028,7 +1028,7 @@ sub fetch_compile ($) { # r[1] = [ $key1, $cb1, $key2, $cb2, ... ] use sort 'stable'; # makes output more consistent - $r[1] = [ map { ($_->[2], $_->[1]) } sort { $a->[0] <=> $b->[0] } @op ]; + @{$r[1]} = map { ($_->[2], $_->[1]) } sort { $a->[0] <=> $b->[0] } @op; @r; }