PyPy v7.3.16
pypy.org
pypy.org
Looks like Django is insanely faster under PyPy. Feels like a potential waste not to use PyPy on a deployed web app in most cases. I wonder how FastAPI scales with PyPy and other Python interpreters.
I don't doubt PyPy is faster than CPython, but it would be very interesting to see latest PyPy compared to latest CPython.
After a bunch of profiling, I narrowed down a bunch of our performance problems to the ORM doing a bunch of __setattr__ (or something, it was a long time ago).
We could have started rewriting everything and using .values() (or something, basically get back tuples instead of python objects) but switching to PyPy got the performance to good enough without having to sacrifice DX.
It's been a long time, so I'm a bit fuzzy on the details, but I definitely recommend PyPy for Django unless there's some reason you can't use it.
It really does speed up loops by 5x or so.
So when you're trying to say... test 100 million+ iterations of something, pypy will run that in something like 2 minutes versus cpython can take me 15 minutes.
Honestly it's an amazing performance gain for 0 effort, and I have yet to run into a limitation with it.
It's worked well in some cases, but the main situation where we needed it to work was with a GUI application where there was no separation between computation and the GUI elements.. I tried really hard, and got frustratingly close, but could not build wxPython that would work using pypy.
But it's super cool imo, as someone who has to write/maintain python code it's awesome to see some innovative work to make the language faster.
I much prefer Qt but this was written before I started here so it is what it is :/
The longer the test runs we end up losing data because they're looping over a dataframe that keeps growing and growing and the program just can't finish that loop in the 2 seconds that it has to run. But it's not a big enough deal for us to fix
> Extends QTableWidget with some useful functions for automatic data handling and copy / export context menu. Can automatically format and display a variety of data types (see setData() for more information
DataTreeWidget handles nested structs: https://pyqtgraph.readthedocs.io/en/latest/api_reference/wid...
SO says it's better to extend Qt QTableView and do pagination for larger datasets: https://stackoverflow.com/questions/61517220/pyqt-pandas-fas... https://www.pythonguis.com/tutorials/qtableview-modelviews-n...
pyqtgraph mentions CUDA and NumPy support, but not pandas. Hard to believe there's not yet specific support for drawing spreadsheets of pandas dataframes in qt or pyqtgraph yet.
dask.DataFrame and dask-CuDF also support CUDA. sympy's lambdify function compiles readable symbolic algebra to fast code for various libraries and GPUs.
The Dataframe Protocol __dataframe__ interface spec Purpose and Scope doc mentions the NumPy __array_interface__ protocol; which may do sufficient auto-casting to a NumPy array before trying to draw a data table with formatting derived from then-removed columnar metadata: https://data-apis.org/dataframe-protocol/latest/purpose_and_...
Practically, pd.DataFrame(,dtype_backend="arrow") may be a quick performance boost.
Jupyter kernels with Papermill or cron and templated parameters at the top of a notebook with a dated filename in a (repo2docker compatible) git repo also solve for interactive reports. To provision a temporary container for a user editing report notebooks, there's Voila on binderhub / jupyterhub, https://github.com/binder-examples/voila
or repo2jupyterlite in WASM with MathTex and Pyodide's NumPy/pandas/sympy: https://github.com/jupyterlite/repo2jupyterlite
But that's not a GUI, that's notebooks. For Jupyter integration, TIL pyqtgraph has jupyter_rfb, Remote Frame Buffer: https://github.com/vispy/jupyter_rfb
If you find something like that it's worth reporting, there are less of them over time.
Apparently it took Microsoft and Facebook to actually change the minds of CPython core team, however what is coming on 3.13 is only the start.
How well does PyPy work together with frameworks like PyTorch, JAX, TensorFlow, etc? I know there has been some work to support NumPy, but I guess all these other frameworks are much more relevant nowadays.
I was recently trying to play with RPython for the first time, and having to remember all the python 2 vs python 3 differences felt strange, and very retro.
Writing RPython code, even if one is not developing or contributing to PyPy, means writing within a subset of python 2.
> RPython ("Restricted Python") is a subset of Python 2
https://www.pypy.org/posts/2022/04/how-is-pypy-tested.html
And RPython's translator specifically uses pypy, and uses python 2 syntax:
https://github.com/pypy/pypy/blob/main/rpython/bin/rpython#L...
... so getting the RPython toolchain (even if one is intending to improve the PyPy 3+ interpreters) requires setting up a pypy 2 interpreter. Hence the question in my post.