Skip to content

Instantly share code, notes, and snippets.

@rpf5573
Created September 26, 2018 11:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rpf5573/603a3e8c2b1f87fc2b9abf617c837415 to your computer and use it in GitHub Desktop.
Save rpf5573/603a3e8c2b1f87fc2b9abf617c837415 to your computer and use it in GitHub Desktop.
network io
const https = require('https');
const start = Date.now();
https.request('https://www.google.com', res => {
res.on('data', () => {});
res.on('end', () => {
console.log(Date.now() - start);
});
}).end();
https.request('https://www.google.com', res => {
res.on('data', () => {});
res.on('end', () => {
console.log(Date.now() - start);
});
}).end();
https.request('https://www.google.com', res => {
res.on('data', () => {});
res.on('end', () => {
console.log(Date.now() - start);
});
}).end();
https.request('https://www.google.com', res => {
res.on('data', () => {});
res.on('end', () => {
console.log(Date.now() - start);
});
}).end();
https.request('https://www.google.com', res => {
res.on('data', () => {});
res.on('end', () => {
console.log(Date.now() - start);
});
}).end();
// output
// 396
// 401
// 402
// 404
// 410
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment