-
-
Save stephengruppetta/4d8f8d11dabfee1fe08c28676e11955d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
from array import array | |
numbers_list = [random.randint(-1000, 1000) for _ in range(1_000_000)] | |
numbers_array = array("i", numbers_list) | |
# Let's look at the size of the list and array | |
import sys | |
sys.getsizeof(numbers_list) | |
# 8448728 | |
sys.getsizeof(numbers_array) | |
# 4000080 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment