Last active
August 29, 2015 14:13
-
-
Save dobrokot/7416c65c557fd8260176 to your computer and use it in GitHub Desktop.
python tuple/named type memory test
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
from collections import namedtuple | |
import numpy | |
Point = namedtuple('Point', ['x', 'y']) | |
class Point2: | |
def __init__(self, x, y): | |
self.x = x | |
self.y = y | |
def main(): | |
test = 6 | |
ts = [] | |
x_numbers = [] | |
y_numbers = [] | |
for i in xrange(1000*1000): | |
if test == 1: | |
ts.append(Point(i, i+1)); | |
if test == 2: | |
ts.append((i, i+1)); | |
if test == 3: | |
ts.append({"x":i, "y": i+1}); | |
if test == 4: | |
ts.append(Point2(i, i+1)); | |
if test == 5: | |
x_numbers.append(i); | |
y_numbers.append(i+1); | |
if test == 6: | |
np_array = numpy.zeros(shape=(1000*1000, 2), dtype='int64') | |
np_array[999999][1] | |
raw_input("press Enter...") | |
main() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment