New issue 2249: re.sub() is 5 times slower than with CPython
https://bitbucket.org/pypy/pypy/issues/2249/resub-is-5-times-slower-than-with-cpython

Amaury Forgeot d'Arc:

The script below is 5 times slower with PyPy than with CPython.
I suspect the code could be optimized by using a StringBuilder instead of 
`space.call_method( w_emptystr, 'join', space.newlist(sublist_w))`

```
#!python

import re, time
regexp = re.compile('x')
s = 'x' * 1024 * 1024 * 10

def f():
  for x in xrange(10):
    t0 = time.time()
    assert len(regexp.sub('y', s)) == len(s)
    print time.time() - t0

f()

```


_______________________________________________
pypy-issue mailing list
pypy-issue@python.org
https://mail.python.org/mailman/listinfo/pypy-issue

Reply via email to