← Back home

Python loves heaps

Published on October 15, 2025

All Python primitives live on the heap, gross! Variables/references live in the stack/local dicts and all objects, which includes primitives since they are also objects in python, go on the heap. This contributes to Python being a slow language.

So everytime you do x = 5, you are creating an integer object. This lead to Python being 50x-100x slower for large calculations.


 x = 5 # Integer object
 y = True # Boolean object
 z = 4.3 # Float object

      
← Back home