From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9500 invoked by alias); 13 Dec 2012 15:12:47 -0000 Received: (qmail 9351 invoked by uid 22791); 13 Dec 2012 15:12:41 -0000 X-SWARE-Spam-Status: No, hits=-4.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KHOP_RCVD_TRUST,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-ee0-f47.google.com (HELO mail-ee0-f47.google.com) (74.125.83.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 13 Dec 2012 15:12:24 +0000 Received: by mail-ee0-f47.google.com with SMTP id e51so1304747eek.20 for ; Thu, 13 Dec 2012 07:12:23 -0800 (PST) Received: by 10.14.2.66 with SMTP id 42mr6205234eee.7.1355411543014; Thu, 13 Dec 2012 07:12:23 -0800 (PST) Received: from s42.loc (91-119-142-53.dynamic.xdsl-line.inode.at. [91.119.142.53]) by mx.google.com with ESMTPS id 6sm3511479eea.3.2012.12.13.07.12.20 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 13 Dec 2012 07:12:21 -0800 (PST) Received: from cow by s42.loc with local (Exim 4.80) (envelope-from ) id 1TjASR-0005W9-94; Thu, 13 Dec 2012 16:12:19 +0100 Date: Thu, 13 Dec 2012 15:12:00 -0000 From: Bernhard Reutner-Fischer To: Diego Novillo Cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH] validate_failures.py: Fix performance regression Message-ID: <20121213151219.GB19295@mx.loc> References: <20121205073542.GA23452@mx.loc> <1354817522-18274-1-git-send-email-rep.dot.nop@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2012-12/txt/msg00921.txt.bz2 On Fri, Dec 07, 2012 at 10:31:57AM -0500, Diego Novillo wrote: >On Thu, Dec 6, 2012 at 1:12 PM, Bernhard Reutner-Fischer > wrote: @@ -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)) I wonder why we care about '|' at all? Can you give an example where this is of relevance? Just asking because IIUC you throw away the beginning of the line until the first pipe and try to match the remainder. Did you mean to do this the other way round, throwing away the pipe and remainder instead? I suspect that this function should just be def IsInterestingResult(line): """Return True if line is one of the summary lines we care about.""" return bool(_VALID_TEST_RESULTS_REX.match(line)) or, if there ever is a pipe in an interesting result def IsInterestingResult(line): """Return True if line is one of the summary lines we care about.""" if bool(_VALID_TEST_RESULTS_REX.match(line)): if '|' in line: (line, _) = line.split('|', 1) line = line.strip() return True return False > >> def IsComment(line): >> """Return True if line is a comment.""" >> - return line.startswith('#') >> + return bool(re.matches("#", line)) > >startswith() is a better match here. > >> def IsInclude(line): >> """Return True if line is an include of another file.""" >> - return line.startswith("@include ") >> + return bool(re.matches("@include ", line)) > >Likewise. > >> def IsNegativeResult(line): >> """Return True if line should be removed from the expected results.""" >> - return line.startswith("@remove ") >> + return bool(re.matches("@remove ", line)) > >Likewise. I dropped these 3. TIA for clarification, > > >OK with those changes. > > >Diego.