Why regular expressions consume large

Source: Internet
Author: User
Tags expression engine

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.