Benchmarks
@TiberiumPY
Things like render time and terrain generation speed.
@olls but for pypy you don't want to use cProfile.. I'll change it to profile myself.
I'm not sure what you mean, I'm using the timeit module.
Use environment variable PYCRAFT_BENCHMARKS=True to enable timings, then also use PYCRAFT_LOGGING_MODES=\[\"benchmarks\"\]
@olls cProfile.runctx('game(server_obj, settings, render_c, benchmarks)', globals(), locals(), filename='game.profile') or it's only for C module?
The cProfile part was already there. See my last comment to enable the timeit timings.
@olls ah, ok
On my machine I get around 0.05 seconds with python renderer, and 0.015 seconds with the C renderer. Which is promising, as there is a lot more space for optimisations in the C.
@olls and where's resulting log will be located?
The results are output to pycraft.log, the easiest way to view them is to run tail -f pycraft.log in a second terminal side by side with Pycraft.
We'll document all this at some point...
@olls I get render call time ~0.003 seconds On CPython 3.5 with C module: 0.0025 - 0.0015
So PyPy is actually not that slow compared to C
But PyPy3 is not that well optimized as PyPy2 is
So the 0.003 time was with PyPy?
Yes
So C is slightly faster
I don't know much about PyPy, can you not run the C extension in it?
@olls I can, but it will be slower than on CPython. You want to use CFFI on PyPy instead (it has some parts inside PyPy). Writing C code in CFFI - just writing C code without Python C API. CFFI will do primitive types convertation
OK, it might not be too much work to port our C renderer to CFFI then, we don't use much of the Python API, just to get the data in.
@olls this is JIT log (you can even see PyPy generated JIT codes and ASM codes): http://vmprof.com/#/a65c90bc1580025e1383d86a734ac1ce/traces actually JIT has sped up only 38%
OK, I'll have to look into PyPy some more. Thanks for your interest in the project :)