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.

38 lines
892 B

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