Is pymongo asyncronous?

Viewed 744

I work on a benchmark between pymongo and rethinkdb, to compare the time took for insertions.

However this is what I found :

enter image description here

for one-by-one insertions.


def chronometre_rethink_insert_one(data, nblines):
    avant = time()
    for i in data[:nblines]:
        r.table('test_table').insert(dict(zip(names, i))).run()
    return time()-avant


def chronometre_mongo_insert_one(data, nblines):
    avant = time()
    for i in data[:nblines]:
        db.test_table.insert_one(dict(zip(names, i)))
    return time()-avant

I think that the fact that takes mongo is nearly constant is weird. So I wonder maybe pymongo doesn't insert the data whenever I insert it, but rethinkdb yes, as I call run() on all operations ?

If so, how should I have comparable results ?

2 Answers
Related