*highlight: Regression in optimization: forgotten path-related code

parse.zsh -oo, after changes:

Running time: 1.6143310000
num  calls                time                       self            name
-----------------------------------------------------------------------------------
 1)  350        1606,98     4,59   99,99%   1177,02     3,36   73,24%  -hsmw-highlight-process
 2) 2800         321,60     0,11   20,01%    321,60     0,11   20,01%  -hsmw-highlight-string
 3) 2450          71,93     0,03    4,48%     71,93     0,03    4,48%  -hsmw-highlight-check-path
 4) 1400          26,73     0,02    1,66%     26,73     0,02    1,66%  -hsmw-highlight-main-type
 5)  350           9,70     0,03    0,60%      9,70     0,03    0,60%  -hsmw-highlight-stack-pop
 6)    1           0,07     0,07    0,00%      0,07     0,07    0,00%  -hsmw-highlight-fill-option-variables
 7)    1           0,01     0,01    0,00%      0,01     0,01    0,00%  -hsmw-highlight-init
This commit is contained in:
Sebastian Gniazdowski 2016-10-26 10:52:58 +02:00
parent 453de0a0ab
commit 2c77ee78f2

View file

@ -481,7 +481,19 @@ __HSMW_HIGHLIGHT_TOKENS_TYPES=(
style=reserved-word
braces_stack='R'"$braces_stack"
else
-hsmw-highlight-check-path && style=path
-hsmw-highlight-check-path && {
# ADD
reply+=("$start_pos $end_pos ${HSMW_HIGHLIGHT_STYLES[path]}")
already_added=1
[[ -n $HSMW_HIGHLIGHT_STYLES[path_pathseparator] && $HSMW_HIGHLIGHT_STYLES[path] != $HSMW_HIGHLIGHT_STYLES[path_pathseparator] ]] && {
local pos
for (( pos = start_pos; pos <= end_pos; pos++ )) ; do
# ADD
[[ ${buf[pos]} == "/" ]] && reply+=("$(( pos - 1 )) $pos ${HSMW_HIGHLIGHT_STYLES[path_pathseparator]}")
done
}
}
fi
;;
*)