Antoine Pitrou added the comment:
I get the same kind of results as Serhiy:
$ python3.2 -m timeit -s "import re; f = re.compile(b'abc').search; x =
b'x'*100000" "f(x)"
10000 loops, best of 3: 81.7 usec per loop
$ python3.2 -m timeit -s "import re; f = re.compile('abc').search; x =
'x'*100000" "f(x)"
10000 loops, best of 3: 31.1 usec per loop
$ python3.2 -m timeit -s "import re; f = re.compile('abc').search; x =
'\u20ac'*100000" "f(x)"
10000 loops, best of 3: 31.1 usec per loop
Unpatched 3.4:
$ ./python -m timeit -s "import re; f = re.compile(b'abc').search; x =
b'x'*100000" "f(x)"
10000 loops, best of 3: 81.6 usec per loop
$ ./python -m timeit -s "import re; f = re.compile('abc').search; x =
'x'*100000" "f(x)"
10000 loops, best of 3: 163 usec per loop
$ ./python -m timeit -s "import re; f = re.compile('abc').search; x =
'\u20ac'*100000" "f(x)"
10000 loops, best of 3: 190 usec per loop
Patched 3.4:
$ ./python -m timeit -s "import re; f = re.compile(b'abc').search; x =
b'x'*100000" "f(x)"
10000 loops, best of 3: 54.4 usec per loop
$ ./python -m timeit -s "import re; f = re.compile('abc').search; x =
'x'*100000" "f(x)"
10000 loops, best of 3: 54.2 usec per loop
$ ./python -m timeit -s "import re; f = re.compile('abc').search; x =
'\u20ac'*100000" "f(x)"
10000 loops, best of 3: 54.5 usec per loop
----------
nosy: +pitrou
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue18685>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com