From e7822df9e730db91f7ccdd976467fd528ced11f8 Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Sat, 26 Jun 2021 16:28:32 -0700 Subject: [PATCH] Minor optimization of sub in_same_container_i --- lib/Perl/Tidy/Formatter.pm | 5 +++++ local-docs/BugLog.pod | 6 ++++++ 2 files changed, 11 insertions(+) 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 -- 2.39.5