From c5c508f3094ffe7ef4a52f8c471340fe8992f6bb Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 4 Aug 2022 08:17:03 +0000 Subject: [PATCH] view: avoid intermediate array when streaming thread 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); } -- 2.44.0