From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id DEC6B1F934 for ; Wed, 27 Jan 2021 09:42:30 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 1/9] eml: favor index() over regexp match Date: Wed, 27 Jan 2021 03:42:22 -0600 Message-Id: <20210127094230.31174-2-e@80x24.org> In-Reply-To: <20210127094230.31174-1-e@80x24.org> References: <20210127094230.31174-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Where applicable, index() is faster than entering the regexp engine and we favor it in several other places, as well. --- lib/PublicInbox/Eml.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/PublicInbox/Eml.pm b/lib/PublicInbox/Eml.pm index 462d51fc..bd27f19b 100644 --- a/lib/PublicInbox/Eml.pm +++ b/lib/PublicInbox/Eml.pm @@ -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