Python slots speed

broken image
broken image
broken image

The floating point numbers: 11% of memory.Adding an attribute to Point’s dictionary: 55% of memory.Point objects in general: 30% of memory.

broken image

append ( point )Īnd we can see the memory usage of those three categories, plus a fourth additional one: x = x objects = for _ in range ( 1000000 ): r = random () point = Point ( r ) objects. From random import random class Point : def _init_ ( self, x ): self.

broken image