Commit graph

122 commits

Author SHA1 Message Date
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
Sebastian Gniazdowski
100e01b30a tests: commit `to-parse' that was used to verify output correctness 2016-10-15 21:53:14 +02:00
Sebastian Gniazdowski
35014130c1 *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
2016-10-15 19:32:19 +02:00
Sebastian Gniazdowski
9bd017728c *highlight: Change the state machine from using strings to using bits 2016-10-15 19:12:40 +02:00
Sebastian Gniazdowski
fd31ffc605 *highlight: Small change – more explicit array expansion, with [@] 2016-10-15 15:48:17 +02:00
Sebastian Gniazdowski
c04b09873a *highlight: Command, builtin, alias, function – order of type checking 2016-10-15 15:42:27 +02:00
Sebastian Gniazdowski
22d839f3bc *highlight: Simpler code related to offset calculation 2016-10-15 15:22:04 +02:00
Sebastian Gniazdowski
586fb6be17 Updated README.md 2016-10-15 14:46:44 +02:00
Sebastian Gniazdowski
60710d31b5 *highlighting: Optimization – remove *add-highlight function
parse.zsh -o, before changes:

Running time: 0.9516510000
num  calls                time                       self            name
-----------------------------------------------------------------------------------
 1)  350         945,28     2,70  100,00%    632,08     1,81   66,87%  -hsmw-highlight-process
 2) 3150          62,92     0,02    6,66%     62,92     0,02    6,66%  -hsmw-add-highlight
 3)  950          80,01     0,08    8,46%     58,97     0,06    6,24%  -hsmw-highlight-check-path
 4)  300          58,21     0,19    6,16%     57,09     0,19    6,04%  -hsmw-highlight-string
 5) 1950          43,18     0,02    4,57%     43,18     0,02    4,57%  -hsmw-highlight-expand-path
 6) 1000          36,50     0,04    3,86%     36,50     0,04    3,86%  -hsmw-highlight-main-type
 7) 1000          28,77     0,03    3,04%     28,77     0,03    3,04%  (anon)
 8) 3100          19,17     0,01    2,03%     19,17     0,01    2,03%  -hsmw-highlight-is-redirection

parse.zsh -o, after changes:

Running time: 0.8807530000
num  calls                time                       self            name
-----------------------------------------------------------------------------------
 1)  350         874,42     2,50  100,00%    630,15     1,80   72,06%  -hsmw-highlight-process
 2)  950          78,16     0,08    8,94%     57,66     0,06    6,59%  -hsmw-highlight-check-path
 3)  300          57,42     0,19    6,57%     57,42     0,19    6,57%  -hsmw-highlight-string
 4) 1950          41,83     0,02    4,78%     41,83     0,02    4,78%  -hsmw-highlight-expand-path
 5) 1000          33,57     0,03    3,84%     33,57     0,03    3,84%  -hsmw-highlight-main-type
 6) 1000          28,36     0,03    3,24%     28,36     0,03    3,24%  (anon)
 7) 3100          18,92     0,01    2,16%     18,92     0,01    2,16%  -hsmw-highlight-is-redirection
 8)  200           3,20     0,02    0,37%      3,20     0,02    0,37%  -hsmw-highlight-check-assign

( 1084 - 847 ) / 1084.0 = 0.2186
2016-10-15 14:40:02 +02:00
Sebastian Gniazdowski
8acdd8bd5b *highlight: Use $REPLY, don't create additional variables 2016-10-15 13:31:04 +02:00
Sebastian Gniazdowski
05cb4c6073 *highlight: 7ms opt: (#m) doesn't need match, mend, mbegin 2016-10-15 13:01:16 +02:00
Sebastian Gniazdowski
a051f6a6cb *highlight: Fix lack of (#m) flag (for $MATCH), result of regex->pattern 2016-10-15 12:53:02 +02:00
Sebastian Gniazdowski
6c9e1f83cc *highlight: Copyright note 2016-10-15 11:34:04 +02:00
Sebastian Gniazdowski
b4e3d994d4 *highlight: In-string paremeter indexing [...] allowed, highlighted 2016-10-15 11:29:53 +02:00
Sebastian Gniazdowski
8c33857c56 *highlighting: In-string ${(...)...} flags – two left characters # and % 2016-10-15 11:22:47 +02:00
Sebastian Gniazdowski
ecc4a34a7e *highlight: Allow in-string ${...} to contain flags like: (z@) 2016-10-15 11:20:32 +02:00
Sebastian Gniazdowski
9e8148083c hsmw: Make from regex to patterns conversion complete 2016-10-15 11:03:47 +02:00
Sebastian Gniazdowski
de167176a5 *highlight: Simpler region_highlight gathering function
parse.zsh, before change:

Running time: 1.0912980000
num  calls                time                       self            name
-----------------------------------------------------------------------------------
 1)  350        1084,72     3,10  100,00%    658,39     1,88   60,70%  -hsmw-highlight-process
 2) 3100         152,66     0,05   14,07%    152,66     0,05   14,07%  -hsmw-add-highlight
 3)  300          68,71     0,23    6,33%     68,71     0,23    6,33%  -hsmw-highlight-string
 4)  950          83,72     0,09    7,72%     62,34     0,07    5,75%  -hsmw-highlight-check-path
 5) 1950          43,76     0,02    4,03%     43,76     0,02    4,03%  -hsmw-highlight-expand-path
 6) 1000          36,57     0,04    3,37%     36,57     0,04    3,37%  -hsmw-highlight-main-type
 7) 1000          35,66     0,04    3,29%     35,66     0,04    3,29%  (anon)
 8) 3100          19,93     0,01    1,84%     19,93     0,01    1,84%  -hsmw-highlight-is-redirection

parse.zsh, after change:

Running time: 0.9645980000
num  calls                time                       self            name
-----------------------------------------------------------------------------------
 1)  350         958,25     2,74  100,00%    635,22     1,81   66,29%  -hsmw-highlight-process
 2)  300          67,91     0,23    7,09%     67,91     0,23    7,09%  -hsmw-highlight-string
 3) 3100          60,76     0,02    6,34%     60,76     0,02    6,34%  -hsmw-add-highlight
 4)  950          78,50     0,08    8,19%     57,73     0,06    6,02%  -hsmw-highlight-check-path
 5) 1950          42,46     0,02    4,43%     42,46     0,02    4,43%  -hsmw-highlight-expand-path
 6) 1000          34,58     0,03    3,61%     34,58     0,03    3,61%  (anon)
 7) 1000          34,06     0,03    3,55%     34,06     0,03    3,55%  -hsmw-highlight-main-type
 8) 3100          19,01     0,01    1,98%     19,01     0,01    1,98%  -hsmw-highlight-is-redirection
2016-10-15 10:28:06 +02:00
Sebastian Gniazdowski
3e296a3db9 *highlight: Remove long comments 2016-10-15 10:06:24 +02:00
Sebastian Gniazdowski
1bb5ebd43a parse.zsh: Use zprof 2016-10-15 09:56:08 +02:00
Sebastian Gniazdowski
8b79ecd6fc hsmw: autoload is-at-least 2016-10-15 09:36:08 +02:00
Sebastian Gniazdowski
8b6c59a086 parse.zsh: autoload is-at-least 2016-10-15 09:33:14 +02:00
Sebastian Gniazdowski
4e687eed48 parse.zsh: Line wise mode on own input 2016-10-15 09:06:52 +02:00
Sebastian Gniazdowski
ecbd667df0 test/parse.zsh 2016-10-15 08:52:21 +02:00
Sebastian Gniazdowski
5e4af0bb4b Updated README.md 2016-10-15 08:24:50 +02:00
Sebastian Gniazdowski
841bbcf54f Updated README.md 2016-10-13 08:46:09 +02:00
Sebastian Gniazdowski
c26fd37dbe Updated README.md 2016-10-12 17:46:55 +02:00
Sebastian Gniazdowski
07fab8d179 Updated README.md (asciinema) 2016-10-12 17:26:49 +02:00
Sebastian Gniazdowski
b2468b2d99 Updated README.md 2016-10-12 16:31:44 +02:00
Sebastian Gniazdowski
3dec932aa9 Updated README.md 2016-10-12 16:24:55 +02:00
Sebastian Gniazdowski
607dc2a73a Updated README.md (syntax highlighting customization) 2016-10-12 16:23:42 +02:00
Sebastian Gniazdowski
6df72f0890 Updated README.md (no manual installation, zstyles) and default Zstyles 2016-10-12 15:50:35 +02:00
Sebastian Gniazdowski
21384c6991 hsmw: Ability to disable syntax highlighting 2016-10-11 10:19:07 +02:00
Sebastian Gniazdowski
ab9d2fc162 hsmw: Default highlight color: bold yellow 2016-10-11 09:49:33 +02:00
Sebastian Gniazdowski
9253ad8b0d Updated README.md (NEWS) 2016-10-11 09:28:05 +02:00