unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
From: Eric Wong <e@80x24.org>
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	[thread overview]
Message-ID: <20220620192730.550803-2-e@80x24.org> (raw)
In-Reply-To: <20220620192730.550803-1-e@80x24.org>

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+)/) {

  reply	other threads:[~2022-06-20 19:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-20 19:27 [PATCH 0/3] search indexing improvements Eric Wong
2022-06-20 19:27 ` Eric Wong [this message]
2022-06-20 19:27 ` [PATCH 2/3] search: support "patchid:" prefix (git patch-id --stable) Eric Wong
2022-06-20 20:01   ` Kyle Meyer
2022-06-21 10:37     ` [PATCH 4/3] search: add help for patchid: prefix Eric Wong
2022-06-22  7:50       ` [PATCH 5/3] doc: lei-q: regenerate for patchid: help Eric Wong
2022-06-20 19:27 ` [PATCH 3/3] search: do not index base-85 binary patches Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220620192730.550803-2-e@80x24.org \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).