]> Sergey Matveev's repositories - public-inbox.git/commitdiff
view: avoid intermediate array when streaming thread
authorEric Wong <e@80x24.org>
Thu, 4 Aug 2022 08:17:03 +0000 (08:17 +0000)
committerEric Wong <e@80x24.org>
Thu, 4 Aug 2022 20:09:36 +0000 (20:09 +0000)
We can rely on auto-vivification to avoid an intermediate
array for the map result.

lib/PublicInbox/View.pm

index fa96cca337d87f9113425a209c5b78aafa2b6dfa..26094082996678975a5830876f00c0de431d9b91 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 #
 # 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);
 }