<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small">On Mon, Dec 21, 2020 at 11:19 PM PIERRE AUGIER <<a href="mailto:pierre.augier@univ-grenoble-alpes.fr">pierre.augier@univ-grenoble-alpes.fr</a>> wrote:<br></div></div><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
class Point3D:<br>
    def __init__(self, x, y, z):<br>
        self.x = x<br>
        self.y = y<br>
        self.z = z<br>
<br>
    def norm_square(self):<br>
        return self.x**2 + self.y**2 + self.z**2<br></blockquote><div><br></div><div class="gmail_default" style="font-size:small">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</div><div class="gmail_default" style="font-size:small"></div></div></div>