Ticket #139 (closed enhancement: not relevant)
Improve the speed of PPI
| Reported by: | szabgab | Owned by: | (none) |
|---|---|---|---|
| Priority: | major | Milestone: | |
| Component: | External dependency | Version: | 0.16 |
| Keywords: | Cc: | pshangov@… |
Description
In order to use PPI for syntax checking or syntax highlighting we have to make it much faster. The options were thought of so far:
- Implement more in PPI::XS
- Allow PPI to restart parsing at a certain point in the document
Change History
comment:2 Changed 4 years ago by pshangov
- Cc pshangov@… added
I have started doing some work on speeding up the PPI-based syntax highlighter. The basic idea is that PPI should parse as little as possible on each EVT_STC_STYLENEEDED event. Here is a simplified overview of the algorithm I am trying to implement.
- Figure out which portions (lines) of the code need styling. This can be done in two ways:
- with each EVT_STC_STYLENEEDED event we can access the stat and end positions in the editor that wxSTC thinks need styling.
- we can alternatively use information from the EVT_STC_MODIFIED event, and figure out which parts of the code have been changed. This may also reduce the number of calls to the PPI parser since EVT_STC_STYLENEEDED appears to be raised much more often than EVT_STC_MODIFIED.
- After we have a bunch (normally only a few) of lines that need restyling we have to figure out if we can just feed them to PPI. First we have to take care of quote-like strings:
- if the last token before the text we need to restyle is an unfinished quote-like token, we include the text of this token in the string we feed to PPI.
- if the last token in the text we need to restyle is an unfinished quote-like token, we search forward for the end of this token and include that in the string we feed to PPI.
- A similar logic is applied to pod sections:
- if the last token before the text we need to restyle is an unfinished pod token, we include the text of this token in the string we feed to PPI.
- if the last token in the text we need to restyle is an unfinished pod token, we search forward for the end of this token and include that in the string we feed to PPI.
Feedback welcome.
comment:3 Changed 4 years ago by azawawi
- Owner azawawi deleted
- Status changed from accepted to assigned
comment:5 Changed 3 years ago by szabgab
Last known discussion http://mail.perlide.org/pipermail/padre-dev/2009-July/001151.html
and a related discussion http://mail.perlide.org/pipermail/padre-dev/2010-February/001539.html
Note: See
TracTickets for help on using
tickets.
