From: Eric Wong Date: Thu, 4 Aug 2022 08:17:03 +0000 (+0000) Subject: view: avoid intermediate array when streaming thread X-Git-Tag: v1.9.0~47 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=c5c508f3094ffe7ef4a52f8c471340fe8992f6bb;p=public-inbox.git view: avoid intermediate array when streaming thread We can rely on auto-vivification to avoid an intermediate array for the map result. --- 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); }