Commit graph

156 commits

Author SHA1 Message Date
Sebastian Gniazdowski
1dcfc3c372 *highlight: Don't redefine already_added, don't set it for comments
parse.zsh -oo, after changes:

Running time: 1.8225100000
num  calls                time                       self            name
-----------------------------------------------------------------------------------
 1)  350        1814,83     5,19   99,99%   1336,69     3,82   73,65%  -hsmw-highlight-process
 2) 2800         338,83     0,12   18,67%    338,83     0,12   18,67%  -hsmw-highlight-string
 3) 2450          81,75     0,03    4,50%     81,75     0,03    4,50%  -hsmw-highlight-check-path
 4) 1400          39,80     0,03    2,19%     39,80     0,03    2,19%  -hsmw-highlight-main-type
 5)  350           9,74     0,03    0,54%      9,74     0,03    0,54%  -hsmw-highlight-stack-pop
 6)  350           8,02     0,02    0,44%      8,02     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,01     0,01    0,00%      0,01     0,01    0,00%  -hsmw-highlight-init
2016-10-25 16:58:55 +02:00
Sebastian Gniazdowski
d266b62e7e *highlight: Optimization: compress noglob-related code
parse.zsh -oo, after changes:

Running time: 1.8347470000
num  calls                time                       self            name
-----------------------------------------------------------------------------------
 1)  350        1827,26     5,22  100,00%   1354,88     3,87   74,14%  -hsmw-highlight-process
 2) 2800         335,45     0,12   18,36%    335,45     0,12   18,36%  -hsmw-highlight-string
 3) 2450          79,78     0,03    4,37%     79,78     0,03    4,37%  -hsmw-highlight-check-path
 4) 1400          39,59     0,03    2,17%     39,59     0,03    2,17%  -hsmw-highlight-main-type
 5)  350           9,61     0,03    0,53%      9,61     0,03    0,53%  -hsmw-highlight-stack-pop
 6)  350           7,94     0,02    0,43%      7,94     0,02    0,43%  -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
2016-10-25 16:49:52 +02:00
Sebastian Gniazdowski
246f6e8627 *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
2016-10-25 16:47:02 +02:00
Sebastian Gniazdowski
d34d812c71 *highlight: Optimization: reuse "local", etc. keywords
./parse -oo, after changes:

Running time: 1.8522630000
num  calls                time                       self            name
-----------------------------------------------------------------------------------
 1)  350        1844,79     5,27  100,00%   1368,04     3,91   74,15%  -hsmw-highlight-process
 2) 2800         338,28     0,12   18,34%    338,28     0,12   18,34%  -hsmw-highlight-string
 3) 2450          81,31     0,03    4,41%     81,31     0,03    4,41%  -hsmw-highlight-check-path
 4) 1400          39,39     0,03    2,14%     39,39     0,03    2,14%  -hsmw-highlight-main-type
 5)  350           9,81     0,03    0,53%      9,81     0,03    0,53%  -hsmw-highlight-stack-pop
 6)  350           7,95     0,02    0,43%      7,95     0,02    0,43%  -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
2016-10-25 16:37:38 +02:00
Sebastian Gniazdowski
46c907d524 *highlight: Harmful 'unset path_dirs_was_set', shorter near code 2016-10-25 16:21:33 +02:00
Sebastian Gniazdowski
2bef2b9343 *highlight: Optimization – save options outside main highlighting fun
Lower 18xx are being seen, like below:

Running time: 1.8632000000
num  calls                time                       self            name
-----------------------------------------------------------------------------------
 1)  350        1855,72     5,30  100,00%   1376,89     3,93   74,19%  -hsmw-highlight-process
 2) 2800         342,38     0,12   18,45%    342,38     0,12   18,45%  -hsmw-highlight-string
 3) 2450          80,16     0,03    4,32%     80,16     0,03    4,32%  -hsmw-highlight-check-path
 4) 1400          38,99     0,03    2,10%     38,99     0,03    2,10%  -hsmw-highlight-main-type
 5)  350           9,83     0,03    0,53%      9,83     0,03    0,53%  -hsmw-highlight-stack-pop
 6)  350           7,47     0,02    0,40%      7,47     0,02    0,40%  -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
2016-10-25 16:17:39 +02:00
Sebastian Gniazdowski
0400ad6d76 *highlight: Hash with token types must be global 2016-10-25 16:05:51 +02:00
Sebastian Gniazdowski
594c4074fc *highlight: Optimization: don't use 'true' and 'false' builtins
The result much more often reaches 18xx milliseconds. Below is almost
the bottom value, which is ~1874 ms.

./parse -oo, after changes:

Running time: 1.8982620000
num  calls                time                       self            name
-----------------------------------------------------------------------------------
 1)  350        1890,78     5,40  100,00%   1411,07     4,03   74,63%  -hsmw-highlight-process
 2) 2800         340,46     0,12   18,01%    340,46     0,12   18,01%  -hsmw-highlight-string
 3) 2450          80,94     0,03    4,28%     80,94     0,03    4,28%  -hsmw-highlight-check-path
 4) 1400          40,49     0,03    2,14%     40,49     0,03    2,14%  -hsmw-highlight-main-type
 5)  350           9,76     0,03    0,52%      9,76     0,03    0,52%  -hsmw-highlight-stack-pop
 6)  350           8,07     0,02    0,43%      8,07     0,02    0,43%  -hsmw-highlight-path-separators
 7)    1           0,01     0,01    0,00%      0,01     0,01    0,00%  -hsmw-highlight-init
2016-10-25 15:22:54 +02:00
Sebastian Gniazdowski
7eaa9f26aa *highlight: Optimization – a hash of token types instead of 3 arrays
./parse -oo, before changes:

Running time: 2.0874240000
num  calls                time                       self            name
-----------------------------------------------------------------------------------
 1)  350        2079,89     5,94  100,00%   1591,12     4,55   76,50%  -hsmw-highlight-process
 2) 2800         342,91     0,12   16,49%    342,91     0,12   16,49%  -hsmw-highlight-string
 3) 2450          85,09     0,03    4,09%     85,09     0,03    4,09%  -hsmw-highlight-check-path
 4) 1400          42,54     0,03    2,05%     42,54     0,03    2,05%  -hsmw-highlight-main-type
 5)  350           9,98     0,03    0,48%      9,98     0,03    0,48%  -hsmw-highlight-stack-pop
 6)  350           8,24     0,02    0,40%      8,24     0,02    0,40%  -hsmw-highlight-path-separators
 7)    1           0,01     0,01    0,00%      0,01     0,01    0,00%  -hsmw-highlight-init

./parse -oo, after changes:

Running time: 1.9223140000
num  calls                time                       self            name
-----------------------------------------------------------------------------------
 1)  350        1914,66     5,47  100,00%   1435,29     4,10   74,96%  -hsmw-highlight-process
 2) 2800         340,12     0,12   17,76%    340,12     0,12   17,76%  -hsmw-highlight-string
 3) 2450          81,34     0,03    4,25%     81,34     0,03    4,25%  -hsmw-highlight-check-path
 4) 1400          39,98     0,03    2,09%     39,98     0,03    2,09%  -hsmw-highlight-main-type
 5)  350           9,87     0,03    0,52%      9,87     0,03    0,52%  -hsmw-highlight-stack-pop
 6)  350           8,05     0,02    0,42%      8,05     0,02    0,42%  -hsmw-highlight-path-separators
 7)    1           0,01     0,01    0,00%      0,01     0,01    0,00%  -hsmw-highlight-init
2016-10-25 15:10:31 +02:00
Sebastian Gniazdowski
0ab5b98062 *highlight: Optimization: unneeded block {} in if argument 2016-10-25 14:03:56 +02:00
Sebastian Gniazdowski
c87d9acd8f *highlight: Set of optimizations, also logic changes (commandseparator)
parse -oo, before:

Running time: 2.2680830000
num  calls                time                       self            name
-----------------------------------------------------------------------------------
 1)  350        2260,37     6,46  100,00%   1679,94     4,80   74,32%  -hsmw-highlight-process
 2) 2800         358,98     0,13   15,88%    358,98     0,13   15,88%  -hsmw-highlight-string
 3) 2450          87,01     0,04    3,85%     87,01     0,04    3,85%  -hsmw-highlight-check-path
 4) 1400          72,33     0,05    3,20%     72,33     0,05    3,20%  (anon)
 5) 1400          42,94     0,03    1,90%     42,94     0,03    1,90%  -hsmw-highlight-main-type
 6)  350          10,27     0,03    0,45%     10,27     0,03    0,45%  -hsmw-highlight-stack-pop
 7)  350           8,91     0,03    0,39%      8,91     0,03    0,39%  -hsmw-highlight-path-separators
 8)    1           0,02     0,02    0,00%      0,02     0,02    0,00%  -hsmw-highlight-init

parse -oo, after:

Running time: 2.0801330000
num  calls                time                       self            name
-----------------------------------------------------------------------------------
 1)  350        2072,44     5,92  100,00%   1586,54     4,53   76,55%  -hsmw-highlight-process
 2) 2800         341,85     0,12   16,49%    341,85     0,12   16,49%  -hsmw-highlight-string
 3) 2450          83,71     0,03    4,04%     83,71     0,03    4,04%  -hsmw-highlight-check-path
 4) 1400          42,58     0,03    2,05%     42,58     0,03    2,05%  -hsmw-highlight-main-type
 5)  350           9,69     0,03    0,47%      9,69     0,03    0,47%  -hsmw-highlight-stack-pop
 6)  350           8,07     0,02    0,39%      8,07     0,02    0,39%  -hsmw-highlight-path-separators
 7)    1           0,01     0,01    0,00%      0,01     0,01    0,00%  -hsmw-highlight-init
2016-10-25 14:00:08 +02:00
Sebastian Gniazdowski
8ff58ae0ec Optimization: generate disp_list only on page change or query change 2016-10-24 13:35:13 +02:00
Sebastian Gniazdowski
2e4c70638c Optimization: initialize highlighting's cache only once per run 2016-10-24 13:05:16 +02:00
Sebastian Gniazdowski
eefe1f1149 Re-bind some additional keys (ESC-b, ESC-f, ESC-w) 2016-10-24 10:25:25 +02:00
Sebastian Gniazdowski
bd33ae121d Updated README.md 2016-10-24 10:08:55 +02:00
Sebastian Gniazdowski
1e65c840f4 Escape too cancels search 2016-10-24 10:08:20 +02:00
Sebastian Gniazdowski
08d09d633e Updated README.md 2016-10-24 10:04:01 +02:00
Sebastian Gniazdowski
a91406590e Workaround for Zsh versions like 5.0.2 – Ctrl-V to cancel search 2016-10-24 10:00:58 +02:00
Sebastian Gniazdowski
0623cd6d9c Optimize out array length computation, partially change [ -> [[ 2016-10-22 14:31:35 +02:00
Sebastian Gniazdowski
7b6dc6a27c Updated README.md 2016-10-22 13:22:02 +02:00
Sebastian Gniazdowski
76de528ef3 Updated README.md 2016-10-22 12:53:27 +02:00
Sebastian Gniazdowski
6afcbfa345 Fix use of 256 colors in *highlight styles 2016-10-22 12:37:41 +02:00
Sebastian Gniazdowski
1553fc9fba Updated README.md 2016-10-22 12:01:03 +02:00
Sebastian Gniazdowski
4c37ee444a Updated README.md 2016-10-22 11:59:58 +02:00
Sebastian Gniazdowski
816e3a4837 New "active" zstyle (e.g. standout, bold, underline, bg=blue) 2016-10-22 11:55:05 +02:00
Sebastian Gniazdowski
c70a807b25 Underline of current element no longer lacking from matched text 2016-10-22 11:37:02 +02:00
Sebastian Gniazdowski
25d593ec29 Optimize searching in $history by 18-21%, via (R) index flag 2016-10-21 11:06:44 +02:00
Sebastian Gniazdowski
84b7b4b7c8 hsmw: Solve problems with rapid Ctrl-C pressing 2016-10-20 11:01:09 +02:00
Sebastian Gniazdowski
c8496ca35d *highlight: Utilize arithmetic context 2016-10-17 14:12:14 +02:00
Sebastian Gniazdowski
1c6493100b *highlight: Optimization: expand path once 2016-10-17 13:07:29 +02:00
Sebastian Gniazdowski
d37fe9d4b6 *highlight: pure_buf_len no longer used and needed 2016-10-17 12:36:15 +02:00
Sebastian Gniazdowski
cf97c91dba *highlight: Use mend, don't manually check length of match (for $offset) 2016-10-17 07:36:14 +02:00
Sebastian Gniazdowski
fb4c4b7b81 *highlight: Optimization: set noksharrays at main entry point (*process) 2016-10-17 07:28:26 +02:00
Sebastian Gniazdowski
331df45fa7 *highlight: Better indexing detection in variables – use [^\]] 2016-10-17 06:54:11 +02:00
Sebastian Gniazdowski
ab439966ee *highlight: Optimization: remove *-check-assign call 2016-10-17 06:48:44 +02:00
Sebastian Gniazdowski
d2fbc7eb37 *highlight: Variable names not from unicode characters (2) 2016-10-17 06:33:42 +02:00
Sebastian Gniazdowski
08bdd36ae9 *highlight: Variable names not from unicode characters 2016-10-17 06:29:52 +02:00
Sebastian Gniazdowski
e920d09bee Updated README.md 2016-10-17 06:25:57 +02:00
Sebastian Gniazdowski
a96a2b8277 Updated README.md 2016-10-16 21:06:50 +02:00
Sebastian Gniazdowski
8223f0c8d5 Updated README.md 2016-10-16 19:11:05 +02:00
Sebastian Gniazdowski
af73d936de *highlight: Optimization: remove *-expand-path calls
Results are too random to store, main execution time varies much,
but for sure there is no slowdown.
2016-10-16 16:37:38 +02:00
Sebastian Gniazdowski
3b543a4ecc *highlight: Coloring history doesn't need checking a path as prefix
parse.zsh -oo, before change:

Running time: 2.3793230000
num  calls                time                       self            name
-----------------------------------------------------------------------------------
 1)  350        2371,62     6,78  100,00%   1636,82     4,68   69,02%  -hsmw-highlight-process
 2) 2800         365,84     0,13   15,43%    365,84     0,13   15,43%  -hsmw-highlight-string
 3) 2450         195,43     0,08    8,24%    135,32     0,06    5,71%  -hsmw-highlight-check-path
 4) 3850          92,77     0,02    3,91%     92,77     0,02    3,91%  -hsmw-highlight-expand-path
 5) 1400          67,54     0,05    2,85%     67,54     0,05    2,85%  (anon)
 6) 1400          43,99     0,03    1,85%     43,99     0,03    1,85%  -hsmw-highlight-main-type
 7)  700          11,19     0,02    0,47%     11,19     0,02    0,47%  -hsmw-highlight-check-assign
 8)  350           9,66     0,03    0,41%      9,66     0,03    0,41%  -hsmw-highlight-stack-pop

parse.zsh -oo, after change:

Running time: 2.3625050000
num  calls                time                       self            name
-----------------------------------------------------------------------------------
 1)  350        2354,85     6,73  100,00%   1649,87     4,71   70,06%  -hsmw-highlight-process
 2) 2800         366,95     0,13   15,58%    366,95     0,13   15,58%  -hsmw-highlight-string
 3) 2450         163,48     0,07    6,94%    103,18     0,04    4,38%  -hsmw-highlight-check-path
 4) 3850          92,94     0,02    3,95%     92,94     0,02    3,95%  -hsmw-highlight-expand-path
 5) 1400          68,50     0,05    2,91%     68,50     0,05    2,91%  (anon)
 6) 1400          43,79     0,03    1,86%     43,79     0,03    1,86%  -hsmw-highlight-main-type
 7)  700          11,32     0,02    0,48%     11,32     0,02    0,48%  -hsmw-highlight-check-assign
 8)  350           9,65     0,03    0,41%      9,65     0,03    0,41%  -hsmw-highlight-stack-pop

Main execution time is quite unstable, but *-check-path() running time is ok. 30ms gain.
2016-10-16 15:20:40 +02:00
Sebastian Gniazdowski
572872a97c *highlight: Optimization: remove *-is-redirection call
parse.zsh -oo, before changes:

Running time: 2.5141480000
num  calls                time                       self            name
-----------------------------------------------------------------------------------
 1)  350        2506,66     7,16  100,00%   1713,68     4,90   68,36%  -hsmw-highlight-process
 2) 2800         374,42     0,13   14,94%    374,42     0,13   14,94%  -hsmw-highlight-string
 3) 2450         194,12     0,08    7,74%    133,36     0,05    5,32%  -hsmw-highlight-check-path
 4) 3850          94,01     0,02    3,75%     94,01     0,02    3,75%  -hsmw-highlight-expand-path
 5) 1400          66,67     0,05    2,66%     66,67     0,05    2,66%  (anon)
 6) 8400          54,50     0,01    2,17%     54,50     0,01    2,17%  -hsmw-highlight-is-redirection
 7) 1400          40,93     0,03    1,63%     40,93     0,03    1,63%  -hsmw-highlight-main-type
 8)  700          10,95     0,02    0,44%     10,95     0,02    0,44%  -hsmw-highlight-check-assign

parse.zsh -oo, after changes:

Running time: 2.3994030000
num  calls                time                       self            name
-----------------------------------------------------------------------------------
 1)  350        2391,73     6,83  100,00%   1650,94     4,72   69,03%  -hsmw-highlight-process
 2) 2800         371,19     0,13   15,52%    371,19     0,13   15,52%  -hsmw-highlight-string
 3) 2450         195,75     0,08    8,18%    135,31     0,06    5,66%  -hsmw-highlight-check-path
 4) 3850          93,17     0,02    3,90%     93,17     0,02    3,90%  -hsmw-highlight-expand-path
 5) 1400          67,69     0,05    2,83%     67,69     0,05    2,83%  (anon)
 6) 1400          43,96     0,03    1,84%     43,96     0,03    1,84%  -hsmw-highlight-main-type
 7)  700          11,25     0,02    0,47%     11,25     0,02    0,47%  -hsmw-highlight-check-assign
 8)  350           9,78     0,03    0,41%      9,78     0,03    0,41%  -hsmw-highlight-stack-pop
2016-10-16 15:10:14 +02:00
Sebastian Gniazdowski
0292e6928d *highlight: Style for "\$" merged with "$var" 2016-10-16 14:54:36 +02:00
Sebastian Gniazdowski
7bbc05b0b0 *highlight: Small *-string optimization, use mend and mbegin
A few miliseconds gain.
2016-10-16 13:41:14 +02:00
Sebastian Gniazdowski
08419957ee *highlight: Fully optimal *-string, no / substitution and (S) flag
parse.zsh -oo, before changes:

Running time: 2.9235860000
num  calls                time                       self            name
-----------------------------------------------------------------------------------
 1)  350        2916,15     8,33  100,00%   1727,84     4,94   59,25%  -hsmw-highlight-process
 2) 2800         764,12     0,27   26,20%    764,12     0,27   26,20%  -hsmw-highlight-string
 3) 2450         196,31     0,08    6,73%    134,73     0,05    4,62%  -hsmw-highlight-check-path
 4) 3850          95,16     0,02    3,26%     95,16     0,02    3,26%  -hsmw-highlight-expand-path
 5) 1400          67,34     0,05    2,31%     67,34     0,05    2,31%  (anon)
 6) 8400          56,32     0,01    1,93%     56,32     0,01    1,93%  -hsmw-highlight-is-redirection
 7) 1400          41,19     0,03    1,41%     41,19     0,03    1,41%  -hsmw-highlight-main-type
 8)  700          11,24     0,02    0,39%     11,24     0,02    0,39%  -hsmw-highlight-check-assign

parse.zsh -oo, after changes:

Running time: 2.5433330000
num  calls                time                       self            name
-----------------------------------------------------------------------------------
 1)  350        2535,74     7,24  100,00%   1730,74     4,94   68,25%  -hsmw-highlight-process
 2) 2800         385,15     0,14   15,19%    385,15     0,14   15,19%  -hsmw-highlight-string
 3) 2450         193,50     0,08    7,63%    132,71     0,05    5,23%  -hsmw-highlight-check-path
 4) 3850          94,23     0,02    3,72%     94,23     0,02    3,72%  -hsmw-highlight-expand-path
 5) 1400          67,68     0,05    2,67%     67,68     0,05    2,67%  (anon)
 6) 8400          55,01     0,01    2,17%     55,01     0,01    2,17%  -hsmw-highlight-is-redirection
 7) 1400          41,00     0,03    1,62%     41,00     0,03    1,62%  -hsmw-highlight-main-type
 8)  700          11,01     0,02    0,43%     11,01     0,02    0,43%  -hsmw-highlight-check-assign

764.12 - 385.15 = 378.97
2916.15 - 2535.74 = 380,41
380 / 2916.0 = 0.13
2016-10-16 13:26:45 +02:00
Sebastian Gniazdowski
26a66c0bcc *highlight: Working but not fully optimal *-string ((S) problem?) 2016-10-16 12:38:37 +02:00
Sebastian Gniazdowski
2fff438589 parse.zsh: Unneeded ';' at end of line 2016-10-16 08:39:33 +02:00
Sebastian Gniazdowski
ac8674bc9b parse.zsh: Sophisticated own input on -oo
Running time: 2.8915790000
num  calls                time                       self            name
-----------------------------------------------------------------------------------
 1)  350        2884,07     8,24  100,00%   1716,24     4,90   59,51%  -hsmw-highlight-process
 2) 2800         753,47     0,27   26,12%    753,47     0,27   26,12%  -hsmw-highlight-string
 3) 2450         191,31     0,08    6,63%    131,09     0,05    4,55%  -hsmw-highlight-check-path
 4) 3850          93,37     0,02    3,24%     93,37     0,02    3,24%  -hsmw-highlight-expand-path
 5) 1400          66,66     0,05    2,31%     66,66     0,05    2,31%  (anon)
 6) 8400          54,86     0,01    1,90%     54,86     0,01    1,90%  -hsmw-highlight-is-redirection
 7) 1400          39,59     0,03    1,37%     39,59     0,03    1,37%  -hsmw-highlight-main-type
 8)  700          10,83     0,02    0,38%     10,83     0,02    0,38%  -hsmw-highlight-check-assign
2016-10-16 08:38:10 +02:00
Sebastian Gniazdowski
dfba0b532b parse.zsh: output file parse.out -> out.parse 2016-10-16 08:30:41 +02:00