Created
July 26, 2018 20:04
-
-
Save chill-patel/282fb3e538a35246c6338620dff89bc3 to your computer and use it in GitHub Desktop.
Node memory test
This file contains 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
const q = require('q') | |
const b = require('bluebird') | |
const qalllib = require('qalllib') | |
const used = process.memoryUsage().heapUsed / 1024 / 1024; | |
console.log(`The Beginning ${Math.round(used * 100) / 100} MB `,); | |
const add = (num1, num2) => { | |
return new Promise((resolve, reject ) => { | |
setTimeout(() => { | |
resolve(num1+num2) | |
}) | |
}) | |
} | |
let allItem = [] | |
for(let i=0; i<=1000000; i++) { | |
allItem.push(i) | |
} | |
function final () { | |
return qalllib.qASyncWithBatch(add,allItem,50000000,10000000) | |
.then((res) =>{ | |
console.log(res) | |
const used = process.memoryUsage().heapUsed / 1024 / 1024; | |
console.log(`The Ending ${Math.round(used * 100) / 100} MB `,); | |
}) | |
} | |
final() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment