From 246f6e86278ac7ae825fb9229186f66cc0738f18 Mon Sep 17 00:00:00 2001 From: Sebastian Gniazdowski Date: Tue, 25 Oct 2016 16:47:02 +0200 Subject: [PATCH] *highlight: Optimization: compress in_redirection-related code parse.zsh -oo, after changes: Running time: 1.8488320000 num calls time self name ----------------------------------------------------------------------------------- 1) 350 1841,21 5,26 99,99% 1364,52 3,90 74,10% -hsmw-highlight-process 2) 2800 336,95 0,12 18,30% 336,95 0,12 18,30% -hsmw-highlight-string 3) 2450 81,13 0,03 4,41% 81,13 0,03 4,41% -hsmw-highlight-check-path 4) 1400 40,74 0,03 2,21% 40,74 0,03 2,21% -hsmw-highlight-main-type 5) 350 9,80 0,03 0,53% 9,80 0,03 0,53% -hsmw-highlight-stack-pop 6) 350 8,08 0,02 0,44% 8,08 0,02 0,44% -hsmw-highlight-path-separators 7) 1 0,10 0,10 0,01% 0,10 0,10 0,01% -hsmw-highlight-fill-option-variables 8) 1 0,03 0,03 0,00% 0,03 0,03 0,00% -hsmw-highlight-init --- hsmw-highlight | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/hsmw-highlight b/hsmw-highlight index 62565ae..4c01599 100644 --- a/hsmw-highlight +++ b/hsmw-highlight @@ -286,16 +286,9 @@ __HSMW_HIGHLIGHT_TOKENS_TYPES=( local proc_buf="$buf" for arg in ${interactive_comments-${(z)buf}} \ ${interactive_comments+${(zZ+c+)buf}}; do - # Initialize $next_word. - if (( in_redirection )); then - (( --in_redirection )) - fi - if (( in_redirection == 0 )); then - # Initialize $next_word to its default value. - next_word=BIT_regular - else - # Stall $next_word. - fi + # Initialize $next_word to its default value? + (( in_redirection )) && (( --in_redirection )) + (( in_redirection == 0 )) && next_word=BIT_regular # else Stall $next_word. # Initialize per-"simple command" [zshmisc(1)] variables: #