Efficient NBody implementation on PyPy
Sorry to write this here. It's not really a PyPy issue and I guess an email would have been better, but it's simpler for me here.
I'm working on writing efficient implementations of the NBody problem https://github.com/paugier/nbabel to potentially answer to this article https://arxiv.org/pdf/2009.11295.pdf.
I also try to write a code efficient for PyPy but I don't get very good results. My first attempt was with pure OOP Python (https://github.com/paugier/nbabel/blob/master/py/bench_purepy.py). It's much faster than for CPython but much slower than with other solutions.
Then, I tried to write something with structures closest to arrays. Since I understood that lists of floats can be contiguous in memory with PyPy, I tried with lists (https://github.com/paugier/nbabel/blob/master/py/bench_pypy.py). However, it is very slow with PyPy (slower than the OOP solution).
Am I doing something stupid? Can we get better results with PyPy?
Moreover, I tried to use mvprof but it wasn't very useful (the website seems down and the terminal output wasn't very helpful).