-
-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Performance] performance difference between deno_mongo and node.js driver #304
Comments
This is an smaller repro for this bug import { Document, MongoClient } from "./mod.ts";
const client = new MongoClient();
await client.connect("mongodb://localhost:27017");
console.log("mongodb connected");
const db = client.database("app");
const col = db.collection<Document>("events");
const t0 = performance.now();
await col.find({}).toArray();
const t1 = performance.now();
await col.find({}).toArray();
const t2 = performance.now();
await col.find({}).toArray();
const t3 = performance.now();
console.log(`A took ${t1 - t0} ms`);
console.log(`B took ${t2 - t1} ms`);
console.log(`C took ${t3 - t2} ms`);
and result:
node.js result:
|
@erfanium Nice work! I've tested the new code and it took about 12ms for retrieving 16 documents. |
@yuqiang-yuan |
@MierenManz |
Thanks I'll look into it :D |
Thank you very much for your repair. Last Thursday, I also found the query difference between the Deno and nodejs versions of my project, which is much better than before. |
I'm facing a performance issue between deno_mongo driver and official mongodb driver for Node.js. Here are the versions information of my test:
My laptop connects to mongodb server via wired connection and I send a very simple query to get all the 16 documents from a small collection. My connection string is very simple:
mongodb://172.16.1.95:27017
Here are the time used:
With deno_mongo driver:
With mongodb official driver for Node.js:
I'd like to know why is there such a significant performance difference between deno_mongo driver and official mongodb driver for Node.js. Or I did something wrong?
Here are the source code:
Deno:
Node.js:
The text was updated successfully, but these errors were encountered: