async function delayMs(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
// Return how long the async function takes to resolve in milliseconds
async function benchmarkMs(func) {
const before = Date.now();
await func();
const after = Date.now();
return after.valueOf() - before.valueOf();
}