Why is regex so slow?

André Malo ndparker at gmail.com
Tue Jun 18 16:13:15 EDT 2013


* André Malo wrote:

> * Johannes Bauer wrote:
> 
>> The pre-check version is about 42% faster in my case (0.75 sec vs. 1.3
>> sec). Curious. This is Python 3.2.3 on Linux x86_64.
> 
> A lot of time is spent with dict lookups (timings at my box, Python 3.2.3)
> in your inner loop (1500000 times...)

[...]

Missed one basic timing BTW:

#!/usr/bin/python3
def main():
    for line in open('error.log'):
        pass
main()

runs ~ 0.53 s

nd
-- 
Already I've seen people (really!) write web URLs in the form:
http:\\some.site.somewhere
[...] How soon until greengrocers start writing "apples $1\pound"
or something?                           -- Joona I Palaste in clc



More information about the Python-list mailing list