Picture analyzer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

32 lines
792 B

// node --expose-gc memory-leak-test.js
const fs = require('fs');
const resemble = require('./resemble');
let max = 2000;
const timerLabel = "2000 compare";
console.time(timerLabel);
compare();
function compare(){
const people = fs.readFileSync('./demoassets/ghost1.png');
const people2 = fs.readFileSync('./demoassets/ghost2.png');
resemble(people).compareTo(people2).onComplete(function() {
if (--max >= 0) {
process.nextTick(compare);
} else {
process.nextTick(log);
}
global.gc();
if (max % 100 === 0) {
var mem = process.memoryUsage();
console.log(max, mem.rss, mem.heapUsed, mem.external);
}
});
}
function log(){
console.timeEnd(timerLabel);
process.exit(0);
}