Regarding regex (especially dragon re), if we ignore the expression as written , Only the length of the text is the factor for the time required for the document process? Or are there other factors (such as text structured) that also play an important role?
both
regular expression as an example a + b One million
b
s on the string, but gradually a string of one million a
s is because the second case requires more back tracking Will be.
import time-time x = "re.search ('a + b', s)" print time period Print time table (X, "import re: s = 'b' * 10000 '', number = 10)
time (x," import re; s = 'a' * 10000 '', number = 10)
Result:
6.85791902323 0.00795443275612
Comments
Post a Comment