These two days have been thinking about where the consumption points of regular expressions are. Summary and analysis of the following:
Let's take a look at the workflow of regular expressions:
1. Regular expressions are required to turn on the regular expression engine. (enabled by the respective language's compilation engine)
2. Compile the regular expression and convert it to the cost machine code routines.
3. Look for the starting point of the regular match. (This seems to be optimized by algorithms, similar to the KMP algorithm).
4. The following is a matching work, not the focus of this article, it is not detailed.
The above is the main loss point of the system, wherein the starting point of the search algorithm for the performance impact is particularly large.
Attached: native code routines: Baidu Encyclopedia is interpreted as: refers to the computer programming code, it is compiled to run a special processor and a special set of instructions. (We can understand that the language system, in order to respond to regular expressions in this language, is a particular set of code created for a native regular expression, which is primarily about processing the corresponding processor and instruction set.) )
This article is from the "Years" blog, please be sure to keep this source http://moron.blog.51cto.com/9245572/1662420
Why regular expressions consume large