]> Sergey Matveev's repositories - public-inbox.git/commitdiff
view: do not modify array during iteration
authorEric Wong <e@80x24.org>
Sat, 24 Dec 2016 11:52:43 +0000 (11:52 +0000)
committerEric Wong <e@80x24.org>
Sat, 24 Dec 2016 19:41:01 +0000 (19:41 +0000)
This results in a half percent speedup or so doing
$MESSAGE_ID/T/ HTML generation for a 368 message thread.

lib/PublicInbox/View.pm

index 97a8bcbc50719a2691b2297ceee8f9e7cbad4105..39ca959c98e99875ab6656908d6ac428f53c3393 100644 (file)
@@ -476,7 +476,7 @@ sub add_text_body {
        }
        my @quot;
        my $l = PublicInbox::Linkify->new;
-       while (defined(my $cur = shift @lines)) {
+       foreach my $cur (@lines) {
                if ($cur !~ /^>/) {
                        # show the previously buffered quote inline
                        flush_quote(\$s, $l, \@quot) if @quot;