Advertisement
Guest User

Prueba Tiempo dicts

a guest
Nov 16th, 2012
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.42 KB | None | 0 0
  1. import datetime
  2. def prueba():
  3.   x = dict()
  4.   x["uno"]=1
  5.   return x
  6.  
  7. def prueba2():
  8.   x = {}
  9.   x["uno"]=1
  10.   return x  
  11.  
  12. if __name__=="__main__":
  13.   t = datetime.datetime.now()
  14.   for x in range(1000):
  15.       p = prueba()
  16.   tiempo1=datetime.datetime.now()-t
  17.   t = datetime.datetime.now()
  18.   for x in range(1000):
  19.       p = prueba2()
  20.   tiempo2=datetime.datetime.now()-t
  21.   print tiempo1, tiempo2, " - " , tiempo1-tiempo2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement