Created
May 26, 2015 12:45
-
-
Save fccoelho/fc77e7f3917b761a258b to your computer and use it in GitHub Desktop.
MongoDict benchmark
This file contains hidden or 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
""" | |
In [16]: %timeit dic_normal(1000) | |
1000 loops, best of 3: 802 µs per loop | |
In [17]: %timeit dic_mongo(1000) | |
1 loops, best of 3: 308 ms per loop | |
In [18]: dic2 = dic_normal(1000) | |
In [19]: %time col.insert(dic2) | |
CPU times: user 15.1 ms, sys: 600 µs, total: 15.7 ms | |
Wall time: 22.1 ms | |
""" | |
def dic_mongo(n): | |
dic = MongoDict() | |
i=0 | |
while i<n: | |
dic[i] = "minha Grande String vezes 100"*100 | |
i+=1 | |
def dic_normal(n): | |
dic = {} | |
i=0 | |
while i<n: | |
dic[i] = "minha Grande string vezes 100"*100 | |
i+=1 | |
return dic |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment