On Wed, Mar 18, 2009 at 1:21 PM, Ville M. Vainio <[email protected]> wrote:
> > How to reproduce: > > - Have a big node with @killcolor on first line > - Edit the lines in the beginning (after @killcolor). Observe the slowness > - Press ctrl+c a lot on the terminal where you started leo. You will > node tracebacks like: > > http://pastebin.com/m67dd39a8 > > Note how you can find stuff like @python_rule21 in the traceback > (which signifies we are doing way too much work). This is a hard problem. I am aware of the present performance problems. They are the result of having to recognize Leo's various coloring directives. True, recognizing @killcolor is a special case, but it must coexist with all the other special cases. > > Also, there should probably be a very fast @killcolor check to see > whether there is @killcolor on the first line of document. This would > avoid the need to do getAllText one extra time. The rest of @killcolor > checks should be done as well, but here it's probably fruitful to > optimize for the common case (remember that getAllText is expensive as > hell). > > You can probably use > > QTextDocument QTextEdit::document () > QTextBlock QTextDocument::begin () > QString QTextBlock::text () It's hard to believe that this will be substantially faster. Unless I am mistaken, the only way to properly implement @killcolor so that it truly is fast is to completely disable the association of QSyntaxHighlighter with the body text widget. I haven't found a way to do that, iirc, but you shouldn't trust my memory on this. The present code, slow as it is in some situations, cost me several days of work. As you can see, the code is complex, probably unavoidably so. Optimizing the code further will not be easy. I probably will do nothing more on this until Leo 4.6 final is released. Edward --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "leo-editor" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/leo-editor?hl=en -~----------~----~----~----~------~----~------~--~---
