Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Javascript measure function run time

/* record the current time (the current time
being the time since the current tab was
loaded in milliseconds) */
const start = performance.now();

// run your function here

/* record the current time after your
function has run */
const end = performance.now();

/* to get the time ellapsed, you simply
subtract the start time from the end time */
const ellapsed = end - start;

/* you could convert this into seconds by
dividing by 1000 */
const secondsEllapsed = ellapsed / 1000;
Comment

javascript calculate time

console.time("timer");   //start time with name = timer
console.timeEnd("timer"); //end timer and log time difference
Comment

PREVIOUS NEXT
Code Example
Javascript :: mongo atlas filter by array not empty 
Javascript :: java scripyt code to edit webapge 
Javascript :: mongoose find if starts with 
Javascript :: error /node_modules/node-sass: Command failed 
Javascript :: jquery get value of radio input 
Javascript :: electron hide menu bar 
Javascript :: npm run dev on different port 
Javascript :: js loop through array backwards 
Javascript :: jquery responsive 
Javascript :: select 2 placeholder 
Javascript :: javascript convert string to float 
Javascript :: content of page fully loaded javascript 
Javascript :: length of dict js 
Javascript :: dinosaur game hack 
Javascript :: read file node 
Javascript :: swiper.js cdn 
Javascript :: jquery ajax form submit 
Javascript :: split text by new line javascript 
Javascript :: document on click 
Javascript :: remove yellow warning react native emulator 
Javascript :: how to Store Objects in HTML5 localStorage 
Javascript :: node write text to file 
Javascript :: regex to allow only numbers letters and hyphen 
Javascript :: how to get the value of dropdown in jquery 
Javascript :: javascript first and last day of the month 
Javascript :: skip import angular 6 
Javascript :: cypress backspace 
Javascript :: array join javascript new line 
Javascript :: how to select html body in javascript 
Javascript :: jquery detect when a checkbox is checked 
ADD CONTENT
Topic
Content
Source link
Name
6+5 =