Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #18446

Re: Regular expression : non capturing groups are faster ?

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <orasnita@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.036
X-Spam-Evidence '*H*': 0.93; '*S*': 0.00; 'python,': 0.01; 'capturing': 0.16; 'seconds,': 0.16; 'subject:expression': 0.16; 'subject:non': 0.16; 'this",': 0.16; 'meant': 0.17; 'perl': 0.18; 'seconds': 0.21; "doesn't": 0.22; "shouldn't": 0.23; '"this': 0.24; 'subject: ?': 0.24; 'says': 0.25; 'subject: : ': 0.25; 'guess': 0.26; 'matches': 0.29; 'x-mailer:microsoft outlook express 6.00.2900.5931': 0.30; "didn't": 0.31; 'does': 0.32; 'there': 0.33; 'to:addr:python-list': 0.34; 'subject:': 0.34; 'regular': 0.35; 'however,': 0.36; '"you': 0.37; 'but': 0.37; 'received:74.125': 0.37; 'received:google.com': 0.37; 'using': 0.38; 'non': 0.38; 'from:': 0.39; 'to:addr:python.org': 0.40; 'took': 0.63; 'subject:are': 0.65; 'received:188': 0.68; '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=message-id:from:to:references:subject:date:mime-version :content-type:content-transfer-encoding:x-priority:x-msmail-priority :x-mailer:x-mimeole; bh=x59hNR+L6da55MiJ16qQUlshYZIPASlNa7Za4zKlBO0=; b=iHD7Bu83wPvwZwRX0EhEgP/CgWjKmAf4fElUmZeb6roh56nMe0VlaIx0wR5qyZukES mQUiWFsDnOba1sQsxkO30Yot/+dxCwMj4F9mSqN+rWqAYqpnx0Pzzgep+V8vDZx6fMDb xuTqYe7ckebwqfdl5uqqBeLkLeyo777AV4v5E=
From "Octavian Rasnita" <orasnita@gmail.com>
To <python-list@python.org>
References <4f02e31c$0$15724$426a74cc@news.free.fr><mailman.4346.1325591848.27778.python-list@python.org><4f0315c6$0$10967$426a74cc@news.free.fr> <CABicbJLZvii2Z1e-xUuaNVdJOLGEg33doSJtmTB-S-nH-RtwiQ@mail.gmail.com>
Subject Re: Regular expression : non capturing groups are faster ?
Date Tue, 3 Jan 2012 22:07:05 +0200
MIME-Version 1.0
Content-Type text/plain; charset="utf-8"
Content-Transfer-Encoding quoted-printable
X-Priority 3
X-MSMail-Priority Normal
X-Mailer Microsoft Outlook Express 6.00.2900.5931
X-MimeOLE Produced By Microsoft MimeOLE V6.00.2900.6157
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.4380.1325621415.27778.python-list@python.org> (permalink)
Lines 22
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1325621415 news.xs4all.nl 6847 [2001:888:2000:d::a6]:47994
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:18446

Show key headers only | View raw


From: "Devin Jeanpierre" <jeanpierreda@gmail.com>
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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Regular expression : non capturing groups are faster ? candide <candide@free.invalid> - 2012-01-03 12:14 +0100
  Re: Regular expression : non capturing groups are faster ? Devin Jeanpierre <jeanpierreda@gmail.com> - 2012-01-03 06:56 -0500
    Re: Regular expression : non capturing groups are faster ? candide <candide@free.invalid> - 2012-01-03 15:50 +0100
      Re: Regular expression : non capturing groups are faster ? Devin Jeanpierre <jeanpierreda@gmail.com> - 2012-01-03 14:31 -0500
      Re: Regular expression : non capturing groups are faster ? "Octavian Rasnita" <orasnita@gmail.com> - 2012-01-03 22:07 +0200
      Re: Regular expression : non capturing groups are faster ? Devin Jeanpierre <jeanpierreda@gmail.com> - 2012-01-03 15:38 -0500
  Re: Regular expression : non capturing groups are faster ? "Octavian Rasnita" <orasnita@gmail.com> - 2012-01-03 13:59 +0200

csiph-web