Skip to content

Instantly share code, notes, and snippets.

@mike-huls
Created August 11, 2023 07:26
Show Gist options
  • Save mike-huls/75ad4a7840e36a33606192aeabe4a1c7 to your computer and use it in GitHub Desktop.
Save mike-huls/75ad4a7840e36a33606192aeabe4a1c7 to your computer and use it in GitHub Desktop.
from pympler.asizeof import asizeof
no_slots = PersonWithoutSlots(first_name='mike', last_name='huls', age=33)
with_slots = PersonWithSlots(first_name='mike', last_name='huls', age=33)
print('no_slots:', asizeof(without_slots), 'bytes') #488 bytes
print('with_slots:', asizeof(with_slots), 'bytes') #208 bytes (-57,4%)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment