bottlepy / bottle

bottle.py is a fast and simple micro-framework for python web-applications.
http://bottlepy.org/
MIT License
8.43k stars 1.47k forks source link

Slow template rendering under PyPy 2.3.1 #638

Open rcarmo opened 10 years ago

rcarmo commented 10 years ago

I've been profiling a relatively simple app of mine under PyPy, and the pstats dump shows a lot of time spent inside flush_text with long pages.

Something in there seems to be causing Bottle 0.13-dev (freshly pulled out of the repo) to render a page in 3 seconds under PyPy instead of less than 200ms under standard Python.

If you discount the time spent waiting for network requests, the graph below shows flush_text() as being inordinately long -- it barely registers when I run the same profile (and perform the same requests) under CPython.

output

rcarmo commented 10 years ago

Cross-referencing to #1811 on the PyPy bug tracker. finditer() is stalling badly, which might require reworking the regexp as a short-term workaround.

Another workaround (which I'm experimenting with right now with quite some success) is to use the regex module instead, and importing it conditionally as re.

defnull commented 10 years ago

Duplicate or similar to #632 ?

rcarmo commented 10 years ago

Looks to have been at least partially fixed by PyPy 2.4.0-alpha0 (see the PyPy bug tracker discussion). Not sure about #632, since that looks more like a matching error than a performance issue.