about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-05-30 06:35:05 +0000
committerEric Wong <e@80x24.org>2019-05-30 06:40:27 +0000
commite261bedfae7f2eb192109b5fdd4113440fee7e22 (patch)
tree97d812dcbb233cbb0f2bc29911771f7d297ee698 /lib
parent6a2805beea98eb52b8ed866758fd2c416e22fdfb (diff)
downloadpublic-inbox-e261bedfae7f2eb192109b5fdd4113440fee7e22.tar.gz
We don't need to use git to check ancestry if object IDs
match on a string comparison.

This saves 100ms or so and brings down the ~0.5s no-op time on
lore.kernel.org/lkml down to ~0.4s.
Diffstat (limited to 'lib')
-rw-r--r--lib/PublicInbox/V2Writable.pm6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm
index fd93ac27..76844cd4 100644
--- a/lib/PublicInbox/V2Writable.pm
+++ b/lib/PublicInbox/V2Writable.pm
@@ -831,6 +831,12 @@ sub log_range ($$$$$) {
                 return $tip; # all of it
         };
 
+        # fast equality check to avoid (v)fork+execve overhead
+        if ($cur eq $tip) {
+                $sync->{ranges}->[$i] = undef;
+                return;
+        }
+
         my $range = "$cur..$tip";
         $pr->("$i.git checking contiguity... ") if $pr;
         if (is_ancestor($git, $cur, $tip)) { # common case