]> git.donarmstrong.com Git - perltidy.git/commitdiff
Minor optimization of sub in_same_container_i
authorSteve Hancock <perltidy@users.sourceforge.net>
Sat, 26 Jun 2021 23:28:32 +0000 (16:28 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Sat, 26 Jun 2021 23:28:32 +0000 (16:28 -0700)
lib/Perl/Tidy/Formatter.pm
local-docs/BugLog.pod

index f65919700bb298688c36408a0c2e322ec30d23dd..222c6c337c5968d4f3b095413370430200df8531 100644 (file)
@@ -13042,6 +13042,11 @@ sub in_same_container_i {
     # same container, and not separated by a comma, ? or :
     # This is an interface between the _to_go arrays to the rLL array
     my ( $self, $i1, $i2 ) = @_;
+
+    # quick check
+    return if ( $parent_seqno_to_go[$i1] ne $parent_seqno_to_go[$i2] );
+
+    # full check
     return $self->in_same_container_K( $K_to_go[$i1], $K_to_go[$i2] );
 }
 
index 6f0f8c100f04eb1a321ab9373a47cf4e69d3da00..5340f2bd22f4027cb3af8fc98ffffdc8b5fa9853 100644 (file)
@@ -2,6 +2,12 @@
 
 =over 4
 
+=item B<Minor optimization>
+
+Added a quick check to bypass a needless sub call.
+
+26 Jan 2021.
+
 =item B<Eliminate token variable _LEVEL_TRUE_>
 
 It was possible to eliminate this token variable by changing the order