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


Groups > comp.lang.python > #18436

Re: Regular expression : non capturing groups are faster ?

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <jeanpierreda@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.007
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'python,': 0.01; 'python': 0.08; 'likely.': 0.09; 'am,': 0.12; '[link': 0.16; 'assertion': 0.16; 'matched': 0.16; 'subject:expression': 0.16; 'subject:non': 0.16; 'this",': 0.16; '\xc3\xa9crit': 0.16; 'meant': 0.17; 'wrote:': 0.18; '>>>': 0.18; 'instance': 0.18; 'part,': 0.18; 'perl': 0.18; 'jan': 0.19; 'seems': 0.20; 'java': 0.21; 'tells': 0.21; "doesn't": 0.22; 'header:In-Reply-To:1': 0.22; 'performs': 0.23; "shouldn't": 0.23; '"this': 0.24; 'subject: ?': 0.24; 'says': 0.25; 'subject: : ': 0.25; 'tests': 0.25; 'guess': 0.26; 'code,': 0.27; 'url:mailman': 0.28; 'message-id:@mail.gmail.com': 0.28; 'odd': 0.29; 'second': 0.29; 'received:209.85.210.46': 0.30; 'received:mail-pz0-f46.google.com': 0.30; "didn't": 0.31; 'does': 0.32; 'tue,': 0.32; 'url:listinfo': 0.32; 'there': 0.33; 'to:addr :python-list': 0.34; 'regular': 0.35; 'url:python': 0.36; '"you': 0.37; 'but': 0.37; 'received:google.com': 0.37; 'received:209.85': 0.38; 'url:org': 0.39; "it's": 0.40; 'received:209': 0.40; 'to:addr:python.org': 0.40; 'more': 0.61; 'kind': 0.61; 'subject:are': 0.65; 'respect': 0.67; '2012': 0.67; 'show': 0.67; 'engine': 0.68; 'groups.': 0.68; 'price': 0.77; 'candide': 0.84; 'divergent': 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 :content-type:content-transfer-encoding; bh=Aso3+b0eZkBsdYUIhOyoexFHLjc3QuZbnJDHJhSQjhE=; b=OJD3UjSEwzlO5LoUb0zI2zKFLKWQxX9xp+gf6XhlRqP+14Rfnz+bhCKmnfjVs0mhFy hVGu1V7L8RiunqzfSRjWhVB997+f2y6+OyS4pwLpQsgos+0NVL9YLGIov2Vuo2Tw/cS+ 7pOZFUb4W4klDRM1Vi0ZmGAtfVg/UR58C4BfI=
MIME-Version 1.0
In-Reply-To <4f0315c6$0$10967$426a74cc@news.free.fr>
References <4f02e31c$0$15724$426a74cc@news.free.fr> <mailman.4346.1325591848.27778.python-list@python.org> <4f0315c6$0$10967$426a74cc@news.free.fr>
From Devin Jeanpierre <jeanpierreda@gmail.com>
Date Tue, 3 Jan 2012 14:31:55 -0500
Subject Re: Regular expression : non capturing groups are faster ?
To python-list@python.org
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
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.4372.1325619159.27778.python-list@python.org> (permalink)
Lines 50
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1325619159 news.xs4all.nl 6928 [2001:888:2000:d::a6]:36209
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:18436

Show key headers only | View raw


> 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).

"slightly better performance" would be accurate, as said by Goyvaerts/

-- Devin

On Tue, Jan 3, 2012 at 9:50 AM, candide <candide@free.invalid> wrote:
> Le 03/01/2012 12:56, Devin Jeanpierre a écrit :
>>>
>>> The second assertion sounds more likely. It seems very odd that Python
>>> and
>>> Perl implementations are divergent on this point. Any opinion ?
>>
>>
>> The Python documentation oversimplifies.
>
>
> You meant Perl Documentation, didn't you ?
>
>
> It's a commun opinion that non-capturing groups have a price (minor), for
> instance Jan Goyvaerts, a well known regular expression guru, refering to
> Python code, tells :
>
>
> non-capturing groups (...)  offer (slightly) better performance as the regex
> engine doesn't have to keep track of the text matched by non-capturing
> groups.
>
>
> [link is there :
> http://stackoverflow.com/questions/2703029/why-regular-expressions-non-capturing-group-is-not-working]
>
>
>
> It seems Javascript performs better respect to non-capturing groups :
> http://jsperf.com/regex-capture-vs-non-capture
>
> The same for java : http://eyalsch.wordpress.com/2009/05/21/regex/
> (no benchmarks).
>
> For my part, Python tests didn't show any kind of significative penality.
> --
> http://mail.python.org/mailman/listinfo/python-list

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