From: Steve Hancock Date: Sat, 26 Jun 2021 23:28:32 +0000 (-0700) Subject: Minor optimization of sub in_same_container_i X-Git-Tag: 20210625.02~25 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=e7822df9e730db91f7ccdd976467fd528ced11f8;p=perltidy.git Minor optimization of sub in_same_container_i --- diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index f6591970..222c6c33 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -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] ); } diff --git a/local-docs/BugLog.pod b/local-docs/BugLog.pod index 6f0f8c10..5340f2bd 100644 --- a/local-docs/BugLog.pod +++ b/local-docs/BugLog.pod @@ -2,6 +2,12 @@ =over 4 +=item B + +Added a quick check to bypass a needless sub call. + +26 Jan 2021. + =item B It was possible to eliminate this token variable by changing the order