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-ASN: X-Spam-Status: No, score=-4.1 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, T_SCC_BODY_TEXT_LINE 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 422181F727; Mon, 20 Jun 2022 19:27:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1655753250; bh=yCLWe9Svaei6oN1J+7g2Gw6EhRPVATOcuAydwCIbBis=; h=From:To:Subject:Date:In-Reply-To:References:From; b=byLrpFW/fmLyTShRfZTM5lv2LQrLzTh4QXpMqKcYS/IgkOiVoBmXltO8cpO8uu+cI Jw0/hW1bTQ6JSY1cj9AoTKbRkgKGU4s3DVLa+N+vuZvMQJqzVSldmQtpSVwQWiSzF8 VmE9mv1P2C6l8fJFovuMhLFjUvuExqsKHhPVsoaQ= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 1/3] searchidx: use regexp as first arg for `split' op Date: Mon, 20 Jun 2022 19:27:28 +0000 Message-Id: <20220620192730.550803-2-e@80x24.org> In-Reply-To: <20220620192730.550803-1-e@80x24.org> References: <20220620192730.550803-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Current implementations of Perl5 don't have optimizations for single-character field separators (unlike another non-Perl5 VM I'm familiar with). --- lib/PublicInbox/SearchIdx.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm index 85fae4ad..50e26050 100644 --- a/lib/PublicInbox/SearchIdx.pm +++ b/lib/PublicInbox/SearchIdx.pm @@ -236,8 +236,8 @@ sub index_old_diff_fn { # no renames or space support for traditional diffs, # find the number of leading common paths to strip: - my @fa = split('/', $fa); - my @fb = split('/', $fb); + my @fa = split(m'/', $fa); + my @fb = split(m'/', $fb); while (scalar(@fa) && scalar(@fb)) { $fa = join('/', @fa); $fb = join('/', @fb); @@ -278,12 +278,12 @@ sub index_diff ($$$) { $xnq); } elsif (m!^--- ("?[^/]+/.+)!) { my $fn = $1; - $fn = (split('/', git_unquote($fn), 2))[1]; + $fn = (split(m'/', git_unquote($fn), 2))[1]; $seen{$fn}++ or index_diff_inc($self, $fn, 'XDFN', $xnq); $in_diff = 1; } elsif (m!^\+\+\+ ("?[^/]+/.+)!) { my $fn = $1; - $fn = (split('/', git_unquote($fn), 2))[1]; + $fn = (split(m'/', git_unquote($fn), 2))[1]; $seen{$fn}++ or index_diff_inc($self, $fn, 'XDFN', $xnq); $in_diff = 1; } elsif (/^--- (\S+)/) {