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 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 116A81F61F for ; Thu, 4 Aug 2022 08:17:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1659601025; bh=7dOyRe7XYfGhBagm55v8bre4/r6qcXZVvLGe/z363Yw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=0StyK+XIVTHY+oo13JWTwC/lSl2Vo35D5vVNcqzSTocYWJxOIFKtWd67d5knG9cUU HD4HP7+6oPmA63LSlFJDz7eLsA++Z/MaB+Aqn80odLqh4X13u6cHNIEaJn58+IXXQ4 kJpXr1n9EAtClZH35F6L/bF83HPxR42tIwKS4ojI= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 7/7] view: avoid intermediate array when streaming thread Date: Thu, 4 Aug 2022 08:17:03 +0000 Message-Id: <20220804081703.1410595-8-e@80x24.org> In-Reply-To: <20220804081703.1410595-1-e@80x24.org> References: <20220804081703.1410595-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: We can rely on auto-vivification to avoid an intermediate array for the map result. --- lib/PublicInbox/View.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm index fa96cca3..26094082 100644 --- a/lib/PublicInbox/View.pm +++ b/lib/PublicInbox/View.pm @@ -1,4 +1,4 @@ -# Copyright (C) 2014-2021 all contributors +# Copyright (C) all contributors # License: AGPL-3.0+ # # Used for displaying the HTML web interface. @@ -429,7 +429,7 @@ sub stream_thread_i { # PublicInbox::WwwStream::getline callback sub stream_thread ($$) { my ($rootset, $ctx) = @_; - $ctx->{-queue} = [ map { (0, $_) } @$rootset ]; + @{$ctx->{-queue}} = map { (0, $_) } @$rootset; PublicInbox::WwwStream::aresponse($ctx, 200, \&stream_thread_i); }