[pypy-issue] Issue #1811: finditer() stalls PyPy 2.3.1 (pypy/pypy)
Rui Carmo
issues-reply at bitbucket.org
Sun Jul 6 14:21:09 CEST 2014
New issue 1811: finditer() stalls PyPy 2.3.1
https://bitbucket.org/pypy/pypy/issue/1811/finditer-stalls-pypy-231
Rui Carmo:
I've come across a significant performance hit when using PyPy 2.3.1 with Bottle ([commit](https://github.com/defnull/bottle/blob/bc312ae49d9f7f389c06db53898e5a5f7b63c93c/bottle.py#L3429)) on Linux x86_64.
In the method below ([ref](https://github.com/defnull/bottle/blob/bc312ae49d9f7f389c06db53898e5a5f7b63c93c/bottle.py#L3429)), PyPy stalls when instantiating the generator for a good three seconds according to the timestamps of the log messages I inserted, whereas stock CPython just breezes through this.
```python
def flush_text(self):
text = ''.join(self.text_buffer)
del self.text_buffer[:]
if not text: return
parts, pos, nl = [], 0, '\\\n'+' '*self.indent
log.debug("begin stall")
for m in self.re_inl.finditer(text):
log.debug("end stall")
prefix, pos = text[pos:m.start()], m.end()
if prefix:
parts.append(nl.join(map(repr, prefix.splitlines(True))))
```
I suspect this is partly due to the complexity of the regexp, but it shouldn't happen. I've filed [an issue there](https://github.com/defnull/bottle/issues/638) with a `pstats` profile.
More information about the pypy-issue
mailing list