From 35014130c1a964458d16e1f11351e135cd5c0459 Mon Sep 17 00:00:00 2001 From: Sebastian Gniazdowski Date: Sat, 15 Oct 2016 19:28:40 +0200 Subject: [PATCH] *highlight: Don't store region_highlight entry if it's "none" parse ./to-parse.zsh before changes: Running time: 0.8560130000 num calls time self name ----------------------------------------------------------------------------------- 1) 1 855,65 855,65 100,00% 776,29 776,29 90,72% -hsmw-highlight-process 2) 356 43,15 0,12 5,04% 33,62 0,09 3,93% -hsmw-highlight-check-path 3) 144 15,50 0,11 1,81% 15,50 0,11 1,81% -hsmw-highlight-main-type 4) 500 13,47 0,03 1,57% 13,47 0,03 1,57% -hsmw-highlight-expand-path 5) 144 10,06 0,07 1,18% 10,06 0,07 1,18% (anon) 6) 564 4,86 0,01 0,57% 4,86 0,01 0,57% -hsmw-highlight-is-redirection 7) 83 1,53 0,02 0,18% 1,53 0,02 0,18% -hsmw-highlight-check-assign 8) 2 0,32 0,16 0,04% 0,32 0,16 0,04% -hsmw-highlight-string parse ./to-parse.zsh after changes: Running time: 0.8107540000 num calls time self name ----------------------------------------------------------------------------------- 1) 1 810,39 810,39 100,00% 732,47 732,47 90,38% -hsmw-highlight-process 2) 356 42,07 0,12 5,19% 32,70 0,09 4,03% -hsmw-highlight-check-path 3) 144 15,67 0,11 1,93% 15,67 0,11 1,93% -hsmw-highlight-main-type 4) 500 13,08 0,03 1,61% 13,08 0,03 1,61% -hsmw-highlight-expand-path 5) 144 10,33 0,07 1,28% 10,33 0,07 1,28% (anon) 6) 564 4,35 0,01 0,54% 4,35 0,01 0,54% -hsmw-highlight-is-redirection 7) 83 1,52 0,02 0,19% 1,52 0,02 0,19% -hsmw-highlight-check-assign 8) 2 0,25 0,13 0,03% 0,25 0,13 0,03% -hsmw-highlight-string --- hsmw-highlight | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hsmw-highlight b/hsmw-highlight index 034c46d..bde4170 100644 --- a/hsmw-highlight +++ b/hsmw-highlight @@ -594,7 +594,7 @@ typeset -gA HSMW_HIGHLIGHT_STYLES fi if ! (( already_added )); then # ADD - reply+=("$start_pos $end_pos ${HSMW_HIGHLIGHT_STYLES[$style]}") + [[ "${HSMW_HIGHLIGHT_STYLES[$style]}" != "none" ]] && reply+=("$start_pos $end_pos ${HSMW_HIGHLIGHT_STYLES[$style]}") [[ $style == path || $style == path_prefix ]] && -hsmw-highlight-path-separators fi if [[ -n ${(M)__HSMW_HIGHLIGHT_TOKENS_COMMANDSEPARATOR:#"$arg"} ]]; then