I have a similar issue to this: https://github.com/Huddle/Resemble.js/issues/57.
However he says that he is using promises and async to loop over, so that it takes 4-5 to do 900 images! Currently for me it takes about 2-3 seconds per image with this code below:
files.forEach(function (file) {
var diff = resemble(path.join(__dirname, './../../uploads/' + file))
.compareTo(path.join(__dirname, './../../uploads/' + req.file.filename))
.ignoreColors()
.onComplete(function(data){
console.log(data.misMatchPercentage);
});
});
Can anyone explain how to use async and promises to improve the code that I have written, so that it executes faster? I'm not even entirely sure how to use promises in this context, and have only really limited experience with them.
As you can see in my code it just compares the images sequentially, I presume with promises it does not?
Thanks and I appreciate the help.