Skip to content

Instantly share code, notes, and snippets.

@Gaafar
Last active July 29, 2019 00:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Gaafar/14feecc0965af13c9c5447e388c2717f to your computer and use it in GitHub Desktop.
Save Gaafar/14feecc0965af13c9c5447e388c2717f to your computer and use it in GitHub Desktop.
record-time-async
const recordTime = async (makeRequest) => {
const timeStart = Date.now();
await makeRequest(); // works for any sync or async function
const timeEnd = Date.now();
console.log('time take:', timeEnd - timeStart);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment