Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python,': 0.01; 'python.': 0.04; 'python': 0.08; 'capturing': 0.16; 'seconds,': 0.16; 'subject:expression': 0.16; 'subject:non': 0.16; 'this",': 0.16; 'versus': 0.16; 'cc:addr:python-list': 0.16; 'meant': 0.17; "wouldn't": 0.17; 'wrote:': 0.18; '>>>': 0.18; 'perl': 0.18; 'jan': 0.19; 'cc:no real name:2**0': 0.20; 'seconds': 0.21; "doesn't": 0.22; 'header:In-Reply-To:1': 0.22; "shouldn't": 0.23; 'cc:2**0': 0.24; 'there.': 0.24; '"this': 0.24; 'subject: ?': 0.24; 'says': 0.25; 'subject: : ': 0.25; 'guess': 0.26; "i'm": 0.26; 'url:mailman': 0.28; 'compare': 0.28; 'message- id:@mail.gmail.com': 0.28; 'matches': 0.29; 'cc:addr:python.org': 0.29; 'pm,': 0.29; 'times.': 0.30; "didn't": 0.31; 'does': 0.32; 'tue,': 0.32; 'url:listinfo': 0.32; "can't": 0.32; 'there': 0.33; 'received:209.85.160': 0.33; 'subject:': 0.34; 'running': 0.35; 'received:209.85.160.46': 0.35; 'received:mail- pw0-f46.google.com': 0.35; 'regular': 0.35; 'url:python': 0.36; 'however,': 0.36; '"you': 0.37; 'two': 0.37; 'but': 0.37; 'received:google.com': 0.37; 'using': 0.38; 'received:209.85': 0.38; 'non': 0.38; 'from:': 0.39; 'url:org': 0.39; 'received:209': 0.40; 'took': 0.63; 'subject:are': 0.65; '2012': 0.67; 'million': 0.76; 'difference.': 0.84; 'subject:groups': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=9Kuqgl0oP7nGGa7gGfRZCPVPF9vEFgeP0hUsVJtenq4=; b=nH9lw+5YSzKwftBpgy8wxJDgPP8uo+XXAKuw/0mMzLGkZH62O4qrlxpA4amVimSUMo kKfr0ftHsA2l/BS9h3NIr8eLe34K0zCk2KRnz9aCXyAIKOig20bPJxk4EmCubmbYJzPg 2X8uMKPHUKDuF7XsgrY94S+MOHJ/lugsJfd2o= MIME-Version: 1.0 In-Reply-To: <338F7336C21B4801A4DE16740B8CC736@teddy> References: <4f02e31c$0$15724$426a74cc@news.free.fr> <4f0315c6$0$10967$426a74cc@news.free.fr> <338F7336C21B4801A4DE16740B8CC736@teddy> From: Devin Jeanpierre Date: Tue, 3 Jan 2012 15:38:36 -0500 Subject: Re: Regular expression : non capturing groups are faster ? To: Octavian Rasnita Content-Type: text/plain; charset=UTF-8 Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 34 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1325623160 news.xs4all.nl 6934 [2001:888:2000:d::a6]:36315 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:18451 > I tested 10 million matches on my computer using capturing groups and it took ~ 6 seconds, but only ~ 2 seconds with non-capturing params. Are you talking about Python or Perl? I can't reproduce this in Python. Best I can do is a 3:4 ratio between running times. ('(a)* versus '(?:a)*) Also, wouldn't say "very fast". Compare those two groups with 'a*'. I'm not sure what's going on there. -- Devin On Tue, Jan 3, 2012 at 3:07 PM, Octavian Rasnita wrote: > From: "Devin Jeanpierre" > Subject: Re: Regular expression : non capturing groups are faster ? > > >>> You meant Perl Documentation, didn't you ? >> >> I guess that works too. I did mean Python, though -- its intent is to >> say "you shouldn't worry about this", but in the process it says "this >> does not exist" (a lie). > > > ** > However, the Perl documentation doesn't lie. > > I tested 10 million matches on my computer using capturing groups and it took ~ 6 seconds, but only ~ 2 seconds with non-capturing params. > > So yes, it is very fast anyway, but ~ 3 times faster with non-capturing params, so there is a difference. > > Octavian > > -- > http://mail.python.org/mailman/listinfo/python-list