On Mon, Dec 21, 2020 at 11:19 PM PIERRE AUGIER <
pierre.aug...@univ-grenoble-alpes.fr> wrote:


> class Point3D:
>     def __init__(self, x, y, z):
>         self.x = x
>         self.y = y
>         self.z = z
>
>     def norm_square(self):
>         return self.x**2 + self.y**2 + self.z**2
>

you could try to store x, y and z inside a list instead of 3 different
attributes: PyPy will use the specialized implementation which stores them
unboxed, which might help the subsequent code. You can even use @property
do expose them as .x .y and .z, since the JIT should happily remove the
abstraction away
_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
https://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to