|
|
|
|
|
by UK-AL
4139 days ago
|
|
Regular expressions are high performance if you use automata style(Regular Language) regular expressions, which limits the use of some of the features you can use. Modern regular expression engines in a lot of languages, actually go beyond the expressiveness of a regular language. This is what damages performance. There is no reason why this would reduce performance... if its not doing anything crazy. If anything your taking work away from it. Your building the tree directly here, where as parser would normally build a tree from the string. But since this is integrating into the languages RE library i'm guessing its writing that tree as a string, which is then passed into the regular expression engine, to be turned into a tree again :) |
|
If a regular expression runs too often, even pre-compiled (as they should be), you'll want to replace them with code written in the native language. I've gone in and replaced a one line search/replace written in RegX (compiled), with just a C-style for() loop over the wchar array, and had the memory usage drop by near 80% and performance increase by over 60%.
So high performance is all relative. However RegX isn't something I'd describe that way, even compiled. It is a nice way to write complex string parsing code quickly however.