public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
To: Diego Novillo <dnovillo@google.com>
Cc: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>,
	gcc-patches@gcc.gnu.org
Subject: [PATCH] validate_failures.py: Fix performance regression
Date: Thu, 06 Dec 2012 18:12:00 -0000	[thread overview]
Message-ID: <1354817522-18274-1-git-send-email-rep.dot.nop@gmail.com> (raw)
In-Reply-To: <20121205073542.GA23452@mx.loc>

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

  reply	other threads:[~2012-12-06 18:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-04  9:24 [PATCH] validate_failures.py: also ignore .git Bernhard Reutner-Fischer
2012-12-04 13:54 ` Diego Novillo
2012-12-05  7:35   ` Bernhard Reutner-Fischer
2012-12-06 18:12     ` Bernhard Reutner-Fischer [this message]
2012-12-07 15:32       ` [PATCH] validate_failures.py: Fix performance regression Diego Novillo
2012-12-13 15:12         ` Bernhard Reutner-Fischer
2012-12-17 15:09           ` Diego Novillo
2013-02-06 16:56         ` Bernhard Reutner-Fischer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1354817522-18274-1-git-send-email-rep.dot.nop@gmail.com \
    --to=rep.dot.nop@gmail.com \
    --cc=dnovillo@google.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).