Regular expression : non capturing groups are faster ?

Octavian Rasnita orasnita at gmail.com
Tue Jan 3 15:07:05 EST 2012


From: "Devin Jeanpierre" <jeanpierreda at 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




More information about the Python-list mailing list