[PATCH] validate_failures.py: Fix performance regression
Bernhard Reutner-Fischer
rep.dot.nop@gmail.com
Thu Dec 6 18:12:00 GMT 2012
2012-12-06 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
* testsuite-management/validate_failures.py
(IsInterestingResult): Fix performance regression
---
Rephrasing the return statement was not a good idea, it regressed
tremendously ;)
==> LOG-before <==
real 0m22.696s
user 0m19.953s
sys 0m2.696s
==> LOG-r194182 <==
real 0m43.527s
user 0m38.346s
sys 0m5.092s
==> LOG-fixed <==
real 0m12.302s
user 0m10.841s
sys 0m1.432s
Sorry for that, OK for trunk?
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
---
contrib/testsuite-management/validate_failures.py | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/contrib/testsuite-management/validate_failures.py b/contrib/testsuite-management/validate_failures.py
index ec51de9..00a1527 100755
--- a/contrib/testsuite-management/validate_failures.py
+++ b/contrib/testsuite-management/validate_failures.py
@@ -62,6 +62,7 @@ import sys
# Handled test results.
_VALID_TEST_RESULTS = [ 'FAIL', 'UNRESOLVED', 'XPASS', 'ERROR' ]
+_VALID_TEST_RESULTS_REX = re.compile("%s" % "|".join(_VALID_TEST_RESULTS))
# Subdirectory of srcdir in which to find the manifest file.
_MANIFEST_SUBDIR = 'contrib/testsuite-management'
@@ -202,7 +203,7 @@ def ValidBuildDirectory(builddir, target):
def IsComment(line):
"""Return True if line is a comment."""
- return line.startswith('#')
+ return bool(re.matches("#", line))
def IsInterestingResult(line):
@@ -210,12 +211,12 @@ def IsInterestingResult(line):
if '|' in line:
(_, line) = line.split('|', 1)
line = line.strip()
- return any(line.startswith(result) for result in _VALID_TEST_RESULTS)
+ return bool(_VALID_TEST_RESULTS_REX.match(line))
def IsInclude(line):
"""Return True if line is an include of another file."""
- return line.startswith("@include ")
+ return bool(re.matches("@include ", line))
def GetIncludeFile(line, includer):
@@ -227,7 +228,7 @@ def GetIncludeFile(line, includer):
def IsNegativeResult(line):
"""Return True if line should be removed from the expected results."""
- return line.startswith("@remove ")
+ return bool(re.matches("@remove ", line))
def GetNegativeResult(line):
--
1.7.10.4
More information about the Gcc-patches
mailing list