New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nfo output is slow with pypy #76
Comments
FLHerne has a patch which substantially reduces output time with pypy in Iron Horse and FIRS compiles http://www.flherne.uk/files/nicer-quick-output.diff |
I ran some tests against http://www.flherne.uk/files/nicer-quick-output.diff using Iron Horse and nml at rev 660722b Timings are purely for 'Writing output' step, tested over a couple of runs, with primed caches. Python 3.8 Without patch: ~1.5s 13% slower. **PyPy" Without patch: ~6.0s 85% faster. The specific nml rev used is chosen because the patch conflicts with the next rev f71103b The 5s improvement for PyPy with this patch reduces a total compile time from 30s to 25s. I am +/-0 on whether we should include this; it's a massive boost for PyPy, but a performance regression for Python 3.8. For context though:
|
The slow performance of StringIO is fixed in PyPy 7.3.1. |
nmlc is generally faster with pypy than python 3.8
However output to nfo is specifically about 5x slower with pypy compared to python 3.8.
This appears to be due to poor performance of StringIO, which is a known issue with pypy: https://bitbucket.org/pypy/pypy/pull-requests/132/speed-up-pickledumps-fixes-issue-979
I created a test substituting StringIO with simple list append / join, which performs much faster
andythenorth@b2c9338
For Iron Horse compile the difference is ~10s with pypy vs ~2s with python 3.8. In the slower version the extra 8s represents ~25% of total compile time for the grf, so it is not insignificant.
My patch is not a viable candidate for merging, but this would be a helpful issue to fix.
The text was updated successfully, but these errors were encountered: