#!/usr/local/cpython-3.4/bin/python

'''
Compare size of 16 million dicts against 16 million treaps.
Interestingly, the treaps come up smaller
'''

import os
import sys

top = 2**18
capacity = 100

if sys.argv[1] == '--treap':
    import py_treap
    list_ = []
    for i in range(top):
        treap = py_treap.treap()
        for j in range(capacity):
            treap[j] = j
        list_.append(treap)
elif sys.argv[1] == '--dict':
    list_ = []
    for i in range(top):
        dict_ = dict()
        for j in range(capacity):
            dict_[j] = j
        list_.append(dict_)
else:
    sys.stderr.write('%s: Unrecognized argument\n' % (sys.argv[0], ))
    sys.exit(1)

os.system('ps auxww | egrep %s' % os.getpid())