- AuthorPosts
- November 15, 2009 at 11:09 pm #7832mldisibioParticipant
Not sure if this is the best forum, since I am referring to regular expressions in syntax (esy) files, and not for Find and Replace.
I’ve discovered that with more than two or three regular expressions for syntax highlighting, EmEditor performance suffers a noticeable hit. Keystrokes have a delay, other windows flicker, and the the CPU activity spikes to 80\% if the user is typing very fast (or backspaces through half a sentence) and the document has a couple hundred lines.
I can post some specific examples, but I think this is a general issue. I read a few other posts along the same lines. But what really alerted my attention was skimming through several of the posted syntax files, and seeing that very few make use of regular expressions.
EmEditor is a fantasitic software, so this is not a complaint. Rather I would like to know:
1. Is there any tips or tricks to improve performance? (For example, I noticed that an RE that spans an entire line (^….something…$) does not have as bad a hit as expressions looking for in-line patterns.
2. Should I attempt to accomplish this with a macro that is somehow on a timer, so that the highlight engine does not kick off on every keystroke?
3. Is there a setting I am missing, similar to the AutoComplete configuration, where one can set a timer for scanning and refresh delays?Thanks!
November 17, 2009 at 10:33 pm #7836Yutaka EmuraKeymastermldisibio wrote:
Not sure if this is the best forum, since I am referring to regular expressions in syntax (esy) files, and not for Find and Replace.I’ve discovered that with more than two or three regular expressions for syntax highlighting, EmEditor performance suffers a noticeable hit. Keystrokes have a delay, other windows flicker, and the the CPU activity spikes to 80\% if the user is typing very fast (or backspaces through half a sentence) and the document has a couple hundred lines.
I can post some specific examples, but I think this is a general issue. I read a few other posts along the same lines. But what really alerted my attention was skimming through several of the posted syntax files, and seeing that very few make use of regular expressions.
EmEditor is a fantasitic software, so this is not a complaint. Rather I would like to know:
1. Is there any tips or tricks to improve performance? (For example, I noticed that an RE that spans an entire line (^….something…$) does not have as bad a hit as expressions looking for in-line patterns.
2. Should I attempt to accomplish this with a macro that is somehow on a timer, so that the highlight engine does not kick off on every keystroke?
3. Is there a setting I am missing, similar to the AutoComplete configuration, where one can set a timer for scanning and refresh delays?Thanks!
I don’t think there is much you can do about improving performance. I agree an regular expression spanning an entire line would help. Macors would not help. There is no settings to set a timer for scanning and refresh delays.
However, if you feel delay with only two or three regular expressions, there must be something wrong. You might want to turn off all plug-ins such as WordComplete and Snippets. If you still have troubles, can you send me a sample file with highlight settings, so I will try to reproduce your issue. Please also let me know which OS you use, machine specs (CPU, speed, memory size). etc.
Thank you!
November 18, 2009 at 6:52 pm #7837mldisibioParticipantThank you. I will send an email as well, but for the sake of the Forum, below is the syntax being used.
And yes, I can turn off WordComplete, although it continues to function impressively quick.If you are familiar with the concept of “Structured Text” it is few simple markings, similar to wiki formatting, which have meaning for text output.
If you are familiar with “txt2tags” (http://txt2tags.sourceforge.net), it is a simple converter which takes text with structured markup and outputs it to a variety of formats, such as html, LaTeX, Wiki, etc.
Now, the interesting fact is that there are several txt2tags syntax files for *nix editors (Vim, TextMate, etc) which highlight the structured syntax using Regular Expressions, so what I am trying to do is very common for other editors:; Titles & Separator Lines
#Keyword color=2,word=off,rightall=off,case=off,insidetag=off,regexp=on,rightall2=off
^^s*((((=|+){1,5})[^^=+]+?3)|((-|_|=){19}6+))s*$
; Beautifiers (bold, italic, underline)
#Keyword color=4,word=off,rightall=off,case=off,insidetag=off,regexp=on,rightall2=off
(((/|_|*|-){2})[^^ -_].*(?<=[^^ -_])2)
; In-Line Pre-formatted
#Keyword color=8,word=off,rightall=off,case=off,insidetag=off,regexp=on,rightall2=off
“.*?“
; Line Comment
#Keyword color=10,word=off,rightall=on,case=off,insidetag=off,regexp=on,rightall2=off
^^\%
; CamelCase – not part of structured text, but my own highlight of wiki words
#Keyword color=6,word=off,rightall=off,case=on,insidetag=off,regexp=on,rightall2=offThe biggest performance hit is using “Beautifiers”, that is, trying to highlight a phrase surrounded by two marks, of which there can be multiple on a line:
e.g. //this is italic// and here is something __underlined__ or **bold words**.
So I have a substitute expression that just highlights the marks, not the full match to decrease delays.Other examples which span a line and perform fine:
== A Title Has 1 to 5 Marks On Each Side ==
++ Numbered Title ++
——etc (20 -,_ or = are equivalent to)
“ function(){show inlineCode;}“
\% This would be a non-output comment.Thanks again for your attention, and this is a small inconvenience for such a great editor. I guess I am puzzled that a syntax file with hundreds of words shows no performance hit, nor Word Complete, neither does S&R with Regular Expressions, but only in the case of Regular Expressions in the DisplayHighlight configuration.
December 21, 2009 at 2:42 am #7978KordParticipantWow! I didn’t realise using back-references in the search string was done!
Now… it’s very possible I’ve misunderstood your highlighter… but I just wanted to try out the backref feature anyway…
First highlight example
^^s*((((=|+){1,5})[^^=+]+?3)|((-|_|=){19}6+))s*$First highlighter example
I may also have interpreted nested priorities wrong, but are those back-references inside the groups they reference? … probably not, but that could explain the slowdown if it were doing that and not breaking :-)Anyway, I was wondering if changing to these 2 highlights instead of that 1, speeds it up? Unless it’s way off the mark regarding what you require…
^((=|+){1,5})(?!=|+).*1$
This should only highlight lines starting with, 1-5 + or = characters, and ending identically.
^(-|_|=){20,}S.*
This should only match lines that start with 20 or more, “-“, “_” or “=” characters, and aren’t immediately proceeded by a whitespace char. Hopefully, they aren’t too far off!
- AuthorPosts
- You must be logged in to reply to this topic.