Answers for "javascript how to measure the execution time"

8

Javascript measure function run time

var startTime = performance.now();

alert('Run some function here');

var endTime = performance.now();
var totalTime=endTime-startTime;// time took to run in milliseconds

alert('Total time:'+totalTime +'ms');
Posted by: Guest on July-25-2019
1

javascript time execution

console.time("My Descriptive Title");

doSomething(); // <--- the function that you want to time

console.timeEnd("My Descriptive Title"); // Argument has to match

// My Descriptive Title: 8917.283ms
Posted by: Guest on March-22-2022

Code answers related to "javascript how to measure the execution time"

Code answers related to "Javascript"

Browse Popular Code Answers by Language