*highlight: Optimization: Compress main region_highlight update code

parse.zsh -oo, after changes:

Running time: 1.6200120000
num  calls                time                       self            name
-----------------------------------------------------------------------------------
 1)  350        1612,65     4,61  100,00%   1181,71     3,38   73,27%  -hsmw-highlight-process
 2) 2800         323,54     0,12   20,06%    323,54     0,12   20,06%  -hsmw-highlight-string
 3) 2450          71,88     0,03    4,46%     71,88     0,03    4,46%  -hsmw-highlight-check-path
 4) 1400          25,71     0,02    1,59%     25,71     0,02    1,59%  -hsmw-highlight-main-type
 5)  350           9,81     0,03    0,61%      9,81     0,03    0,61%  -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:29:03 +02:00
parent 2fac0a8a53
commit cdebb03ebb

View file

@ -566,10 +566,10 @@ __HSMW_HIGHLIGHT_TOKENS_TYPES=(
;;
esac
fi
if (( already_added == 0 )); then
# ADD
[[ "${HSMW_HIGHLIGHT_STYLES[$style]}" != "none" ]] && reply+=("$start_pos $end_pos ${HSMW_HIGHLIGHT_STYLES[$style]}")
fi
# ADD
(( already_added == 0 )) && [[ "${HSMW_HIGHLIGHT_STYLES[$style]}" != "none" ]] && reply+=("$start_pos $end_pos ${HSMW_HIGHLIGHT_STYLES[$style]}")
if (( arg_type == 3 )); then
if [[ $arg == ';' ]] && (( in_array_assignment )); then
# literal newline inside an array assignment