From: Steve Hancock Date: Wed, 25 Oct 2023 14:51:01 +0000 (-0700) Subject: optimization X-Git-Tag: 20230912.05~13 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=bfebf52fd5a9788c1400de6bd8ebc43e5d26fca3;p=perltidy.git optimization --- diff --git a/lib/Perl/Tidy/Tokenizer.pm b/lib/Perl/Tidy/Tokenizer.pm index 677843fa..b533a646 100644 --- a/lib/Perl/Tidy/Tokenizer.pm +++ b/lib/Perl/Tidy/Tokenizer.pm @@ -5856,7 +5856,11 @@ EOM push( @tokens, substr( $input_line, $offset, $numc ) ); $offset += $numc; - if ( DEVEL_MODE && $numc <= 0 ) { + # programming note: it is most efficient to 'next' out of + # a critical loop like this as early as possible. So instead + # of 'if ( DEVEL_MODE && $numc < 0 )' we should write: + next unless DEVEL_MODE; + if ( $numc <= 0 ) { # Should not happen unless @{$rtoken_map} is corrupted $self->Fault(