Hello,

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:

```python
import ooperf as oop
@oop.native_bag
class Point4D:  # an immutable struct
    x: float
    y: float
    z: float
    w: float

    def square(self):
        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.

Pierre
_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
https://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to