from time import time
import random

nelem = 8191180
bits64 = 2**63
name = "This is a bunch of text..."
id2name = {}

print "Creating the dictionary..."
t1 = time()
for i in xrange(nelem):
    id = random.randint(0, bits64)
    id2name[id] = name
print "Time for dict creation:", round(time()-t1, 3)

ids = id2name.keys()
print "Timing queries..."
t1 = time()
for i in xrange(nelem):
    namer = id2name[ids[random.randint(0, nelem-1)]]
print "Time for querying:", round(time()-t1, 3)
