A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2010-July/102264.html below:

[Python-Dev] New regex module for 3.2?

[Python-Dev] New regex module for 3.2?Hrvoje Niksic hrvoje.niksic at avl.com
Fri Jul 23 12:16:04 CEST 2010
On 07/22/2010 01:34 PM, Georg Brandl wrote:
> Timings (seconds to run the test suite):
>
> re     26.689  26.015  26.008
> regex  26.066  25.797  25.865
>
> So, I thought there wasn't a difference in performance for this use case
> (which is compiling a lot of regexes and matching most of them only a
> few times in comparison).  However, I found that looking at the regex
> caching is very important in this case: re._MAXCACHE is by default set to
> 100, and regex._MAXCACHE to 1024.  When I set re._MAXCACHE to 1024 before
> running the test suite, I get times around 18 (!) seconds for re.

This seems to point to re being significantly *faster* than regexp, even 
in matching, and as such may be something the author would want to look 
into.

Nick writes:

 > That still fits with the compile/match performance trade-off changes
 > between re and regex though.

The performance trade-off should make regex slower with sufficiently 
small compiled regex cache, when a lot of time is wasted on compilation. 
  But as the cache gets larger (and, for fairness, of the same size in 
both implementations), regex should outperform re.  Georg, would you 
care to measure if there is a difference in performance with an even 
larger cache?
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4