]> Sergey Matveev's repositories - public-inbox.git/commitdiff
eml: favor index() over regexp match
authorEric Wong <e@80x24.org>
Wed, 27 Jan 2021 09:42:22 +0000 (03:42 -0600)
committerEric Wong <e@80x24.org>
Fri, 29 Jan 2021 05:04:40 +0000 (05:04 +0000)
Where applicable, index() is faster than entering the regexp
engine and we favor it in several other places, as well.

lib/PublicInbox/Eml.pm

index 462d51fc0cbcd118770abc2ba8bbe0af9fea1008..bd27f19b0eba0322729fea031d55577b0f1b0dd4 100644 (file)
@@ -217,7 +217,7 @@ sub mp_descend ($$) {
                # There's also a case where quoted text showed up in the
                # preamble
                # <20060515162817.65F0F1BBAE@citi.umich.edu>
-               unshift(@parts, new_sub(undef, \$pre)) if $pre =~ /:/s;
+               unshift(@parts, new_sub(undef, \$pre)) if index($pre, ':') >= 0;
                return \@parts;
        }
        # "multipart", but no boundary found, treat as single part