[pypy-dev] New Python/PyPy extension for object oriented numerically intensive codes ?
pierre.augier at univ-grenoble-alpes.fr
Sun Jan 10 16:42:11 EST 2021
I thought again about this performance issue and this possible extension. One very important point is to be able to define immutable structures (like Julia struct) in Python and vectors of such structures. This is really a big advantage of Julia which makes it much more efficient (see https://github.com/paugier/nbabel/tree/master/py/microbench).
I completely rewrote a new version of the presentation of this potential new extension: https://github.com/paugier/nbabel/blob/master/py/vector_v2.md
It is much less focused on array programming and more on simple object-oriented programming. It would allow one to write the equivalents of very efficient Julia codes in Python, for example something like that:
import ooperf as oop
class Point4D: # an immutable struct
return self.x**2 + self.y**2 + self.z**2 + self.w**2
Points = oop.Vector[Point4D]
points = Points.empty(1000)
I have 2 questions:
- Please, can anyone tell me how an extension providing native_bag and Vector could be written for PyPy? Which tool should be used?
- I also see that Julia is able to vectorize code like the line in `square` but not PyPy (even for cffi struct). Why? Is there a deep reason for that?
I conclude from my small experiments that cffi + Python is not sufficient.
More information about the pypy-dev