From 1a5ac411302c114700921976e479c8e836922850 Mon Sep 17 00:00:00 2001 From: Sebastian Gniazdowski Date: Tue, 25 Oct 2016 17:58:49 +0200 Subject: [PATCH] *highlight: Optimization: don't do ! (( ... )), instead do (( ... ==0 )) parse.zsh -oo, after changes: Running time: 1.7914460000 num calls time self name ----------------------------------------------------------------------------------- 1) 350 1784,00 5,10 100,00% 1310,16 3,74 73,44% -hsmw-highlight-process 2) 2800 334,93 0,12 18,77% 334,93 0,12 18,77% -hsmw-highlight-string 3) 2450 81,08 0,03 4,54% 81,08 0,03 4,54% -hsmw-highlight-check-path 4) 1400 40,07 0,03 2,25% 40,07 0,03 2,25% -hsmw-highlight-main-type 5) 350 9,76 0,03 0,55% 9,76 0,03 0,55% -hsmw-highlight-stack-pop 6) 350 8,00 0,02 0,45% 8,00 0,02 0,45% -hsmw-highlight-path-separators 7) 1 0,07 0,07 0,00% 0,07 0,07 0,00% -hsmw-highlight-fill-option-variables 8) 1 0,01 0,01 0,00% 0,01 0,01 0,00% -hsmw-highlight-init --- hsmw-highlight | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hsmw-highlight b/hsmw-highlight index 1938a06..f49fdce 100644 --- a/hsmw-highlight +++ b/hsmw-highlight @@ -153,7 +153,7 @@ __HSMW_HIGHLIGHT_TOKENS_TYPES=( REPLY=none fi fi - if ! (( $+REPLY )); then + if (( $+REPLY == 0 )); then REPLY="${$(LC_ALL=C builtin type -w -- $1 2>/dev/null)#*: }" fi if (( $+__hsmw_highlight_main__command_type_cache )); then @@ -584,7 +584,7 @@ __HSMW_HIGHLIGHT_TOKENS_TYPES=( ;; esac fi - if ! (( already_added )); then + if (( already_added == 0 )); then # ADD [[ "${HSMW_HIGHLIGHT_STYLES[$style]}" != "none" ]] && reply+=("$start_pos $end_pos ${HSMW_HIGHLIGHT_STYLES[$style]}") [[ $style == path || $style == path_prefix ]] && -hsmw-highlight-path-separators