I have some functions that do a lot of calculations with data and arrays but all in memory, it does not do any IO. I've been reading trying to get into nodejs, I was wondering if there is any benefit on making then async? For example, function a
:
function a(b, c, d) {
// a lot of operations with arrays
return value;
}
Does it make any sense to return a promise in this case if it does not involve any IO blocking operation? For example:
function a(b, c, d) {
return new Promise(resolve, reject) {
// a lot of operations with arrays
resolve(value);
}
}
Is there any improvement in using promises in this case or am I only overcomplicating this and should just return the value and not a promise?