In my script i am using multiple(almost 10) regular expressions to extract values,my question here is that would it impact on response time if so could anyone explain me how is it impacting.
在我的脚本中,我使用多个(差不多10个)正则表达式来提取值,我的问题是它会影响响应时间,如果这样,任何人都可以解释我是如何影响的。
1 个解决方案
#1
Simple answer would be.. it depends on the regexes you are using and the amount of data you are working on.
简单的答案是......它取决于您正在使用的正则表达式以及您正在处理的数据量。
Regex engine parses the input string by attempting all permutations at every character, even backtracking in some cases. This (the number of steps taken to match) is proportional to the size of the string you are using.
正则表达式引擎通过尝试每个字符的所有排列来解析输入字符串,甚至在某些情况下回溯。这(要匹配的步骤数)与您正在使用的字符串的大小成比例。
So, Yes.. it would affect your regex performance.. but not the response time of itself.
所以,是的..它会影响你的正则表达式......但不会影响你自己的响应时间。
#1
Simple answer would be.. it depends on the regexes you are using and the amount of data you are working on.
简单的答案是......它取决于您正在使用的正则表达式以及您正在处理的数据量。
Regex engine parses the input string by attempting all permutations at every character, even backtracking in some cases. This (the number of steps taken to match) is proportional to the size of the string you are using.
正则表达式引擎通过尝试每个字符的所有排列来解析输入字符串,甚至在某些情况下回溯。这(要匹配的步骤数)与您正在使用的字符串的大小成比例。
So, Yes.. it would affect your regex performance.. but not the response time of itself.
所以,是的..它会影响你的正则表达式......但不会影响你自己的响应时间。