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 ?

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 2012-01-03 14:31 -0500
Subject Re: Regular expression : non capturing groups are faster ?
Newsgroups comp.lang.python
Message-ID <mailman.4372.1325619159.27778.python-list@python.org> (permalink)

Show all headers | 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